From 44daf808737f85ff462905269c7a1e66d52e2fff Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Wed, 13 Feb 2019 15:44:03 +0200 Subject: fix strncpy bounds errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit error: 'strncpy' specified bound 4096 equals destination size [-Werror=stringop-truncation] Based on patch by Elan Ruusamäe --- libfetch/http.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libfetch/http.c') diff --git a/libfetch/http.c b/libfetch/http.c index 638c9a8..5a515cb 100644 --- a/libfetch/http.c +++ b/libfetch/http.c @@ -496,10 +496,10 @@ http_next_header(conn_t *conn, const char **p) static int http_parse_mtime(const char *p, time_t *mtime) { - char locale[64], *r; + char *locale, *r; struct tm tm; - strncpy(locale, setlocale(LC_TIME, NULL), sizeof(locale)); + locale = strdupa(setlocale(LC_TIME, NULL)); setlocale(LC_TIME, "C"); r = strptime(p, "%a, %d %b %Y %H:%M:%S GMT", &tm); /* XXX should add support for date-2 and date-3 */ -- cgit v1.2.3-60-g2f50