Le mardi 30 mars 2010 à 19:12 +0200, Karel Zak a écrit : > On Tue, Mar 30, 2010 at 05:17:55PM +0200, Yann Droneaud wrote: > > You've made little mistakes in your fixes to mount and mkswap: > > - one must check that endptr doesn't match the string pointer to convert > > if ((endptr && *endptr) || > > is enough, because endptr == str means that endptr is not empty > See the output of this little test function call with an empty string: int test(const char *s) { char *endptr = NULL; unsigned long l; printf("s = '%s'\n", s); errno = 0; l = strtoul(s, &endptr, 0); printf(" errno = %d\n", errno); printf(" l = %lu 0x%08lX\n", l, l); printf(" str = %p\n", s); printf(" endptr = %p\n", endptr); if (endptr != NULL) { printf(" *endptr = '%c' (0x%02x)\n", *endptr, *endptr); } return 0; } s = '' errno = 0 l = 0 0x00000000 str = 0x804865c endptr = 0x804865c *endptr = '' (0x00) endptr is not NULL and *endptr point to '\0'. > > otherwise empty string will be accepted as correct (eg *str == '\0', so > > if endptr == str, *endptr == '\0'). > > - when using strtoll(), overflow must be check against LLONG_MIN and LLONG_MAX. > > xnum < 0) > > is enough, because LLONG_MIN is smaller than zero. > True, but you still have to correct the ULLONG_MAX use instead of LLONG_MAX. > > Please apply the following patches. > > Anyway, I have replaced the strtoll() with strtosize() in mount(8) > too. So mount(8) is compatible with losetup now. > I've seen this too late. BTW, my patch against mkswap worth to be applied. Regards. -- Yann Droneaud -- To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html