From 2643e4e881eb11c1ca1fbd551ce60f035a32007b Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 11 Nov 2015 14:48:10 +0100 Subject: geoip: Don't NULL-terminate download buffer The end of the buffer might already contain part of the data payload. Setting the last byte to 0 will thus corrupt the gz file, leading to failed decompression (or previously, to invalid GeoIP database files). The NULL-termination is not necessary in this case, so just omit it. Signed-off-by: Tobias Klauser --- geoip.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/geoip.c b/geoip.c index 439c052..aa435b0 100644 --- a/geoip.c +++ b/geoip.c @@ -198,8 +198,6 @@ again: return -EIO; } - raw[sizeof(raw) - 1] = 0; - for (i = 0; i < ret; i++) { if (!strncmp(raw + i, "Content-Length: ", min_t(size_t, ret - i, lenl))) { ptr = raw + i + lenl; -- cgit v1.2.3-54-g00ecf