2017-09-25 Paul Eggert <eggert@cs.ucla.edu>
+ uniname/uniname-tests: integer overflow fix
+ * tests/uniname/test-uninames.c (fill_names, fill_aliases):
+ Check for integer overflow.
+
duplocale-tests: fix unlikely crash
* tests/test-duplocale.c (get_locale_dependent_values):
Don’t crash with absurdly long month names.
char *p;
char *comment;
unsigned int i;
+ unsigned long ul;
lineno++;
exit (EXIT_FAILURE);
}
*p = '\0';
- i = strtoul (field0, NULL, 16);
- if (i >= 0x110000)
+ ul = strtoul (field0, NULL, 16);
+ if (ul >= 0x110000)
{
fprintf (stderr, "index too large\n");
exit (EXIT_FAILURE);
}
+ i = ul;
unicode_names[i] = xstrdup (field1);
}
if (ferror (stream) || fclose (stream))
char *p;
char *comment;
unsigned int uc;
+ unsigned long ul;
comment = strchr (line, '#');
if (comment != NULL)
}
*p = '\0';
- uc = strtoul (field0, NULL, 16);
- if (uc >= 0x110000)
+ ul = strtoul (field0, NULL, 16);
+ if (ul >= 0x110000)
{
fprintf (stderr, "index too large\n");
exit (EXIT_FAILURE);
}
+ uc = ul;
if (aliases_count == ALIASLEN)
{