writing to c_str() - secure?
Posted: Thu Feb 09, 2006 03:35
for example:
-----
float Spinner::getValueFromText(void) const
{
// handle empty case
if (d_editbox->getText().empty())
{
return 0.0f;
}
int res, tmp;
uint utmp;
float val;
switch (d_inputMode)
{
case FloatingPoint:
res = sprintf_s(d_editbox->getText().c_str(), d_editbox->getText().max_size(), "%f", &val);
-----
writes to c_str(). if i replace sprintf with sprintf_s, what should i use as size? d_editbox->getText().max_size() ?
(i'am "porting" the 0.41 source to vc8)
best regards,
thomas
-----
float Spinner::getValueFromText(void) const
{
// handle empty case
if (d_editbox->getText().empty())
{
return 0.0f;
}
int res, tmp;
uint utmp;
float val;
switch (d_inputMode)
{
case FloatingPoint:
res = sprintf_s(d_editbox->getText().c_str(), d_editbox->getText().max_size(), "%f", &val);
-----
writes to c_str(). if i replace sprintf with sprintf_s, what should i use as size? d_editbox->getText().max_size() ?
(i'am "porting" the 0.41 source to vc8)
best regards,
thomas