]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
settings: coverity - limit the gzip contents to 10M
authorJaroslav Kysela <perex@perex.cz>
Mon, 23 May 2016 19:00:42 +0000 (21:00 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 23 May 2016 19:00:57 +0000 (21:00 +0200)
src/settings.c

index 89a3ee56198cbda0493a2e55baff117bf4db1fd1..037dd586790bdaaf5899c8f72af24a3da0d508b9 100644 (file)
@@ -236,7 +236,10 @@ hts_settings_load_one(const char *filename)
     if (size > 12 && memcmp(mem, "\xff\xffGZIP00", 8) == 0) {
 #if ENABLE_ZLIB
       uint32_t orig = (mem[8] << 24) | (mem[9] << 16) | (mem[10] << 8) | mem[11];
-      if (orig > 0) {
+      if (orig > 10*1024*1024U) {
+        tvhlog(LOG_ALERT, "settings", "too big gzip for %s", filename);
+        r = NULL;
+      } else if (orig > 0) {
         uint8_t *unpacked = tvh_gzip_inflate((uint8_t *)mem + 12, size - 12, orig);
         if (unpacked) {
           r = htsmsg_binary_deserialize(unpacked, orig, NULL);