diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-12 09:20:44 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-12 09:20:44 +0000 |
commit | a46dd89e9451ec73a4df54427110cdfc28d8b031 (patch) | |
tree | 2e470b3c0236524905a6d399c5207cccaef2fc7b /procps | |
parent | 39acf453353a41a78fbc220360e884eb0eb33a59 (diff) | |
download | busybox-a46dd89e9451ec73a4df54427110cdfc28d8b031.tar.gz |
cpio: internalize archive_xread_all_eof. add a few paranoia checks
for corrupted cpio files.
modprobe-small: remove stray include
route: small code shrink
function old new delta
get_header_cpio 958 980 +22
archive_xread_all_eof 33 - -33
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 22/-33) Total: -11 bytes
Diffstat (limited to 'procps')
-rw-r--r-- | procps/fuser.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/procps/fuser.c b/procps/fuser.c index 8afa958b6..d8005b568 100644 --- a/procps/fuser.c +++ b/procps/fuser.c @@ -100,7 +100,6 @@ static inode_list *scan_proc_net(const char *proto, unsigned port, inode_list *ilist) { char path[20], line[MAX_LINE + 1]; - char addr[128]; ino_t tmp_inode; dev_t tmp_dev; long long uint64_inode; @@ -115,13 +114,15 @@ static inode_list *scan_proc_net(const char *proto, return ilist; while (fgets(line, MAX_LINE, f)) { + char addr[64]; if (sscanf(line, "%*d: %64[0-9A-Fa-f]:%x %*x:%*x %*x %*x:%*x " "%*x:%*x %*x %*d %*d %llu", addr, &tmp_port, &uint64_inode) == 3 ) { - if (strlen(addr) == 8 && (option_mask32 & OPT_IP6)) + int len = strlen(addr); + if (len == 8 && (option_mask32 & OPT_IP6)) continue; - if (strlen(addr) > 8 && (option_mask32 & OPT_IP4)) + if (len > 8 && (option_mask32 & OPT_IP4)) continue; if (tmp_port == port) { tmp_inode = uint64_inode; |