From: Rich Felker Date: Thu, 20 Oct 2016 17:22:20 +0000 (-0400) Subject: fix gratuitous undefined behavior in strptime X-Git-Tag: v1.1.16~45 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f33b17585058381491e6fda08f491b8e48c7980c;p=oweals%2Fmusl.git fix gratuitous undefined behavior in strptime accessing an object of type const char *restrict as if it had type char * is not defined. --- diff --git a/src/time/strptime.c b/src/time/strptime.c index f41f55f2..55c7ed1b 100644 --- a/src/time/strptime.c +++ b/src/time/strptime.c @@ -22,8 +22,13 @@ char *strptime(const char *restrict s, const char *restrict f, struct tm *restri } f++; if (*f == '+') f++; - if (isdigit(*f)) w=strtoul(f, (void *)&f, 10); - else w=-1; + if (isdigit(*f)) { + char *new_f; + w=strtoul(f, &new_f, 10); + f = new_f; + } else { + w=-1; + } adj=0; switch (*f++) { case 'a': case 'A':