diff options
author | itojun <itojun> | 2000-01-17 06:24:23 +0000 |
---|---|---|
committer | itojun <itojun> | 2000-01-17 06:24:23 +0000 |
commit | dff10c7f70d539c431a1eba9ab5e076d8b0f5c8e (patch) | |
tree | 29fbd05a7fa3afbeba9b422f86f9995c166d2eaa /print-snmp.c | |
parent | 92d3fd1b47a8c041297a3dfa655f0d548012f61c (diff) | |
download | tcpdump-dff10c7f70d539c431a1eba9ab5e076d8b0f5c8e.tar.gz |
s/sprintf/snprintf/.
there seem to be couple of unsafe use of strcat and strcpy - we should
bring in strl{cat,cpy}.
Diffstat (limited to 'print-snmp.c')
-rw-r--r-- | print-snmp.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/print-snmp.c b/print-snmp.c index b5835dc1..503fc967 100644 --- a/print-snmp.c +++ b/print-snmp.c @@ -45,7 +45,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-snmp.c,v 1.39 1999-12-22 06:27:22 itojun Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-snmp.c,v 1.40 2000-01-17 06:24:26 itojun Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -188,7 +188,8 @@ char *ErrorStatus[] = { }; #define DECODE_ErrorStatus(e) \ ( e >= 0 && e < sizeof(ErrorStatus)/sizeof(ErrorStatus[0]) \ - ? ErrorStatus[e] : (sprintf(errbuf, "err=%u", e), errbuf)) + ? ErrorStatus[e] \ + : (snprintf(errbuf, sizeof(errbuf), "err=%u", e), errbuf)) /* * generic-trap values in the SNMP Trap-PDU @@ -205,7 +206,8 @@ char *GenericTrap[] = { }; #define DECODE_GenericTrap(t) \ ( t >= 0 && t < sizeof(GenericTrap)/sizeof(GenericTrap[0]) \ - ? GenericTrap[t] : (sprintf(buf, "gt=%d", t), buf)) + ? GenericTrap[t] \ + : (snprintf(buf, sizeof(buf), "gt=%d", t), buf)) /* * ASN.1 type class table @@ -730,11 +732,12 @@ asn1_print(struct be *elem) } d += (elem->data.uns64.low & 0xfffff000); #if 0 /*is looks illegal, but what is the intention???*/ - sprintf(first, "%.f", d); + snprintf(first, sizeof(first), "%.f", d); #else - sprintf(first, "%f", d); + snprintf(first, sizeof(first), "%f", d); #endif - sprintf(last, "%5.5d", elem->data.uns64.low & 0xfff); + snprintf(last, sizeof(last), "%5.5d", + elem->data.uns64.low & 0xfff); for (carry = 0, cpf = first+strlen(first)-1, cpl = last+4; cpl >= last; cpf--, cpl--) { |