]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS: Check for theoretical gmtime() failure
authorJouni Malinen <j@w1.fi>
Sat, 7 Jun 2014 14:39:51 +0000 (17:39 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 7 Jun 2014 14:39:51 +0000 (17:39 +0300)
In theory, gmtime() could return NULL if the year value would not fit
into an integer. However, that cannot really happen with the current
time() value in practice. Anyway, clean up static analyzer reports by
checking for this corner case.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/wps/wps_upnp.c

index 6fb3d4c55cae8d5a69ea8dd8f62152a18ff59fcb..f62b49e60bc0115c3f2f300fb939abb4dce46843 100644 (file)
@@ -227,6 +227,8 @@ void format_date(struct wpabuf *buf)
 
        t = time(NULL);
        date = gmtime(&t);
+       if (date == NULL)
+               return;
        wpabuf_printf(buf, "%s, %02d %s %d %02d:%02d:%02d GMT",
                      &weekday_str[date->tm_wday * 4], date->tm_mday,
                      &month_str[date->tm_mon * 4], date->tm_year + 1900,