diff options
author | Ivan Nardi <nardi.ivan@gmail.com> | 2025-03-03 12:47:46 +0100 |
---|---|---|
committer | Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> | 2025-03-03 13:18:21 +0100 |
commit | f3dcae88dc2ac7cdd38f23d3ffa3a814f71ef925 (patch) | |
tree | acc9cc4d62fc6ba1961390ed54ce73dd51ec1aa1 /src | |
parent | 322ef9873c1a151b95bbee20571a4330d93a13a4 (diff) |
Address cache: fix a use-of-uninitialized-value error on cache restore
```
==29602==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x563af77d47ac in ndpi_address_cache_restore /home/ivan/svnrepos/nDPI/src/lib/ndpi_cache.c:450:8
#1 0x563af77d6b52 in ndpi_cache_address_restore /home/ivan/svnrepos/nDPI/src/lib/ndpi_cache.c:518:10
#2 0x563af77c73e5 in LLVMFuzzerTestOneInput /home/ivan/svnrepos/nDPI/fuzz/fuzz_ds_address_cache.cpp:100:5
```
Found by oss-fuzz.
See: https://oss-fuzz.com/testcase-detail/6653546833707008
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/ndpi_cache.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/ndpi_cache.c b/src/lib/ndpi_cache.c index c4e25ffea..b97bbcff3 100644 --- a/src/lib/ndpi_cache.c +++ b/src/lib/ndpi_cache.c @@ -446,7 +446,7 @@ u_int32_t ndpi_address_cache_restore(struct ndpi_address_cache *cache, char *pat if(!fd) return(false); - while(fscanf(fd, "%32s\t%255s\t%u\n", ip, hostname, &epoch) > 0) { + while(fscanf(fd, "%32s\t%255s\t%u\n", ip, hostname, &epoch) == 3) { if(epoch >= epoch_now) { /* Entry not yet expired */ u_int ttl = epoch-epoch_now; ndpi_ip_addr_t addr; |