]> granicus.if.org Git - sysstat/commitdiff
Fix possible buffer overflow
authorSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 12 Apr 2014 14:46:39 +0000 (16:46 +0200)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 12 Apr 2014 14:46:39 +0000 (16:46 +0200)
From dcb314:

[rd_stats.c:835]: (warning) scanf without field width limits can crash
with huge input data.

So changed "n = fscanf(fp, "%s", duplex);" with
"n = fscanf(fp, "%31s", duplex);".

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
rd_stats.c

index 5b8ebda6ed86f396066307530b4403d0b8919579..c79bd5606be7af6863d14edd233a633f68cf4a77 100644 (file)
@@ -832,7 +832,7 @@ void read_if_info(struct stats_net_dev *st_net_dev, int nbr)
                        /* Cannot read NIC duplex */
                        continue;
 
-               n = fscanf(fp, "%s", duplex);
+               n = fscanf(fp, "%31s", duplex);
 
                fclose(fp);