diff options
author | gerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7> | 2000-06-18 22:12:14 +0000 |
---|---|---|
committer | gerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7> | 2000-06-18 22:12:14 +0000 |
commit | d681b45ec2b86e202376b8ef4d85e23127e52ccc (patch) | |
tree | 0fcb14a020ba36357a1a39c6aa6db6e9e7d91ed9 /packet-syslog.c | |
parent | 2032c6fae8b0441dc5db8163aa4ffe9bcd815ee5 (diff) |
Get rid of string overrun.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@2078 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-syslog.c')
-rw-r--r-- | packet-syslog.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/packet-syslog.c b/packet-syslog.c index 192e79ffd0..d04530b181 100644 --- a/packet-syslog.c +++ b/packet-syslog.c @@ -3,7 +3,7 @@ * * Copyright 2000, Gerald Combs <gerald@zing.org> * - * $Id: packet-syslog.c,v 1.3 2000/06/15 03:48:43 gram Exp $ + * $Id: packet-syslog.c,v 1.4 2000/06/18 22:12:14 gerald Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -45,9 +45,7 @@ /* The maximum number if priority digits to read in. */ #define MAX_DIGITS 3 -/* On my RH 6.2 box, memcpy overwrites nearby chunks of memory if this is - a multiple of four... */ -#define COL_INFO_LEN 35 +#define COL_INFO_LEN 32 #define ELLIPSIS "..." /* ISO 8859-1 doesn't appear to have a real ellipsis. */ static const value_string short_lev[] = { @@ -180,10 +178,9 @@ static void dissect_syslog(const u_char *pd, int o, frame_data *fd, proto_tree * /* Copy the message into a string buffer, with a trailing ellipsis if needed. */ msg_len = tvb_length_remaining(tvb, msg_off); - if (msg_len > ellipsis_len) { + if (msg_len >= COL_INFO_LEN) { tvb_memcpy(tvb, msg_str, msg_off, ellipsis_len); strcpy (msg_str + ellipsis_len, ELLIPSIS); - msg_str[COL_INFO_LEN] = '\0'; } else { tvb_memcpy(tvb, msg_str, msg_off, msg_len); msg_str[msg_len] = '\0'; |