summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2016-10-20 13:22:20 -0400
committerRich Felker <dalias@aerifal.cx>2016-10-20 13:22:20 -0400
commitf33b17585058381491e6fda08f491b8e48c7980c (patch)
treef451555ca40b5583925f24f739fdcf1592616fc7 /src
parentb24f1d2520c87077cef21e085893e5f3c565a6df (diff)
downloadmusl-f33b17585058381491e6fda08f491b8e48c7980c.tar.gz
musl-f33b17585058381491e6fda08f491b8e48c7980c.tar.bz2
musl-f33b17585058381491e6fda08f491b8e48c7980c.tar.xz
musl-f33b17585058381491e6fda08f491b8e48c7980c.zip
fix gratuitous undefined behavior in strptime
accessing an object of type const char *restrict as if it had type char * is not defined.
Diffstat (limited to 'src')
-rw-r--r--src/time/strptime.c9
1 files changed, 7 insertions, 2 deletions
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':