Skip to content

Commit 678697b

Browse files
committed
Added buffer boundary check to avoid potential buffer overflow
1 parent e946f49 commit 678697b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib/ndpi_cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ u_int32_t ndpi_address_cache_restore(struct ndpi_address_cache *cache, char *pat
439439

440440
if(!fd) return(false);
441441

442-
while(fscanf(fd, "%s\t%s\t%u\n", ip, hostname, &epoch) > 0) {
442+
while(fscanf(fd, "%32s\t%255s\t%u\n", ip, hostname, &epoch) > 0) {
443443
if(epoch >= epoch_now) { /* Entry not yet expired */
444444
u_int ttl = epoch-epoch_now;
445445
ndpi_ip_addr_t addr;

0 commit comments

Comments
 (0)