]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: skip unexpected tags when deserializing protobuf messages 17869/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 5 Aug 2026 12:07:06 +0000 (14:07 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 5 Aug 2026 12:07:06 +0000 (14:07 +0200)
Buys more robustness against future changes.

Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
pdns/recursordist/rec-nsspeeds.cc
pdns/recursordist/recursor_cache.cc

index 3daef07e29dc7e0a8b048e5ddcfc3c8116e3d75d..5093024ec53408be66a4453c93ebf4a2512c4e9a 100644 (file)
@@ -133,11 +133,17 @@ bool nsspeeds_t::putPBEntry(time_t cutoff, T& message)
         case PBNSSpeedMap::required_int32_last:
           last = map.get_int32();
           break;
+        default:
+          map.skip();
+          break;
         }
       }
       entry.insert(address, val, last);
       break;
     }
+    default:
+      message.skip();
+      break;
     }
   }
   if (!entry.stale(cutoff)) {
@@ -202,6 +208,9 @@ size_t nsspeeds_t::putPB(time_t cutoff, const std::string& pbuf)
         ++theCount;
         break;
       }
+      default:
+        full.skip();
+        break;
       }
     }
     log->info(Logr::Info, "Processed nsspeed dump", "processed", Logging::Loggable(theCount), "inserted", Logging::Loggable(inserted));
index e566675b79089494ea3539daa458e90016fb26b1..06ad2dea39541e0b32973631ac6e5b2321af0061 100644 (file)
@@ -1150,6 +1150,7 @@ static void putAuthRecord(protozero::pbf_message<PBCacheEntry>& message, const D
       authRecord.d_clen = auth.get_uint32();
       break;
     default:
+      auth.skip();
       break;
     }
   }
@@ -1221,6 +1222,7 @@ bool MemRecursorCache::putRecordSet(T& message)
       cacheEntry.d_tcp = message.get_bool();
       break;
     default:
+      message.skip();
       break;
     }
   }
@@ -1289,6 +1291,9 @@ size_t MemRecursorCache::putRecordSets(const std::string& pbuf)
         ++count;
         break;
       }
+      default:
+        full.skip();
+        break;
       }
     }
     log->info(Logr::Info, "Processed cache dump", "processed", Logging::Loggable(count), "inserted", Logging::Loggable(inserted));