Work around broken scanf() implementations.

This commit is contained in:
Markus F.X.J. Oberhumer 2007-03-22 07:30:16 +01:00
parent 0e2fa6eb9d
commit 0fcaa3a2f5

View File

@ -228,15 +228,20 @@ void ElfLinker::preprocessSymbols(char *start, char *end)
assert(nextl != NULL);
if (sscanf(start, "%x g *ABS* %x %1023s",
&value, &offset, symbol) == 3)
&value, &offset, symbol) == 3)
{
char *s = strstr(start, symbol);
s[strlen(symbol)] = 0;
addSymbol(s, "*ABS*", value);
assert(offset == 0);
}
#if 0
else if (sscanf(start, "%x%*8c %1023s %*x %1023s",
&offset, section, symbol) == 3)
#else
// work around broken scanf implementations
else if (sscanf(start, "%x%*c%*c%*c%*c%*c%*c%*c%*c %1023s %*x %1023s",
#endif
&offset, section, symbol) == 3)
{
char *s = strstr(start, symbol);
s[strlen(symbol)] = 0;