diff options
author | Guy Harris <guy@alum.mit.edu> | 2003-08-04 07:38:15 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2003-08-04 07:38:15 +0000 |
commit | 29e5ea2e2a16a1c40f88cced19f4e3e0a842bc01 (patch) | |
tree | 4354434b81fa1cc37cc7432d2cf7f1c98994a16b /packet-snmp.c | |
parent | 4ccbfa3edca9d6b6abc2ad46f7734be82f5e994e (diff) |
UCD SNMP sometimes puts newlines into the printable form of an SNMP
value; turn those newlines into spaces, as the text for a protocol tree
item shouldn't contain newlines (or tabs, or any other non-printable
characters).
svn path=/trunk/; revision=8124
Diffstat (limited to 'packet-snmp.c')
-rw-r--r-- | packet-snmp.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/packet-snmp.c b/packet-snmp.c index b542ab04ad..00af00900f 100644 --- a/packet-snmp.c +++ b/packet-snmp.c @@ -10,7 +10,7 @@ * * See RFCs 2570-2576 for SNMPv3 * - * $Id: packet-snmp.c,v 1.110 2003/06/19 10:25:10 sahlberg Exp $ + * $Id: packet-snmp.c,v 1.111 2003/08/04 07:38:15 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -643,6 +643,7 @@ format_var(struct variable_list *variable, subid_t *variable_oid, guchar *buf; size_t buf_len; size_t out_len; + size_t i; switch (vb_type) { @@ -724,6 +725,17 @@ format_var(struct variable_list *variable, subid_t *variable_oid, out_len = 0; sprint_realloc_value(&buf, &buf_len, &out_len, 1, variable_oid, variable_oid_length, variable); + + /* + * "sprint_realloc_value" can put newlines into the string it + * produces; turn them into spaces, as this is all supposed to be + * on a single line. + */ + for (i = 0; i < out_len; i++) { + if (buf[i] == '\n') + buf[i] = ' '; + } + return buf; } #endif |