Fix invalid pointer dereference in AsciiFormatter.

Using a temporary object with strtol() makes the end pointer that it
sets invalid after the call.
This commit is contained in:
Jon Siwek 2013-08-29 15:50:46 -05:00
parent b6e2505202
commit c4e8908c8e

View file

@ -247,7 +247,8 @@ threading::Value* AsciiFormatter::ParseValue(string s, string name, TypeTag type
goto parse_error; goto parse_error;
} }
uint8_t width = (uint8_t) strtol(s.substr(pos+1).c_str(), &end, 10); string width_str = s.substr(pos + 1);
uint8_t width = (uint8_t) strtol(width_str.c_str(), &end, 10);
if ( CheckNumberError(s, end) ) if ( CheckNumberError(s, end) )
goto parse_error; goto parse_error;