diff options
author | 2017-07-06 16:23:11 +0000 | |
---|---|---|
committer | 2017-07-06 16:23:11 +0000 | |
commit | 6022c2c21c00ed222314d1a82f05f5778bfe1e32 (patch) | |
tree | e443b9b2cd22244c94bdda0d882caaec6db4c5af /lib/libc/stdlib/strtoll.c | |
parent | fix broken cross references; found with mandoc -Tlint (diff) | |
download | wireguard-openbsd-6022c2c21c00ed222314d1a82f05f5778bfe1e32.tar.xz wireguard-openbsd-6022c2c21c00ed222314d1a82f05f5778bfe1e32.zip |
The 0x (or 0X) prefix in base 16 is optional so only skip over the
prefix if the character following it is a valid hex char. The C99
standard is clear that given the string "0xy" zero should be returned
and endptr set to point to the "x". OK deraadt@ espie@
Diffstat (limited to 'lib/libc/stdlib/strtoll.c')
-rw-r--r-- | lib/libc/stdlib/strtoll.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/stdlib/strtoll.c b/lib/libc/stdlib/strtoll.c index 0ba51da77e8..d21a249a0b8 100644 --- a/lib/libc/stdlib/strtoll.c +++ b/lib/libc/stdlib/strtoll.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strtoll.c,v 1.9 2015/09/13 08:31:48 guenther Exp $ */ +/* $OpenBSD: strtoll.c,v 1.10 2017/07/06 16:23:11 millert Exp $ */ /* * Copyright (c) 1992 The Regents of the University of California. * All rights reserved. @@ -77,8 +77,8 @@ strtoll(const char *nptr, char **endptr, int base) if (c == '+') c = *s++; } - if ((base == 0 || base == 16) && - c == '0' && (*s == 'x' || *s == 'X')) { + if ((base == 0 || base == 16) && c == '0' && + (*s == 'x' || *s == 'X') && isxdigit((unsigned char)s[1])) { c = s[1]; s += 2; base = 16; |