aboutsummaryrefslogtreecommitdiffstats
path: root/libfetch/http.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2019-02-13 15:44:03 +0200
committerTimo Teräs <timo.teras@iki.fi>2019-02-13 16:05:27 +0200
commit44daf808737f85ff462905269c7a1e66d52e2fff (patch)
tree08a62633282647b9695adc2a460b1dbe0799bab6 /libfetch/http.c
parent86922d1a34fc1004f439b0b86bfbd908a9f07422 (diff)
downloadaports-44daf808737f85ff462905269c7a1e66d52e2fff.tar.bz2
aports-44daf808737f85ff462905269c7a1e66d52e2fff.tar.xz
fix strncpy bounds errors
error: 'strncpy' specified bound 4096 equals destination size [-Werror=stringop-truncation] Based on patch by Elan Ruusamäe <glen@delfi.ee>
Diffstat (limited to 'libfetch/http.c')
-rw-r--r--libfetch/http.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libfetch/http.c b/libfetch/http.c
index 638c9a8660..5a515cbf21 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 */