diff options
author | Gerald Combs <gerald@wireshark.org> | 2009-07-17 15:59:24 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2009-07-17 15:59:24 +0000 |
commit | 25e7cac69d5d8b3dfb1e50104f9de53397f207a7 (patch) | |
tree | 597e3bfa43df7685371f81548450c68a8fcf9144 /epan/to_str.c | |
parent | 891d655e8ad94e46ced1034f0334a2c2f0765556 (diff) |
Fix an ep buffer overrun introduced in r29130.
svn path=/trunk/; revision=29133
Diffstat (limited to 'epan/to_str.c')
-rw-r--r-- | epan/to_str.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/epan/to_str.c b/epan/to_str.c index 99d92b6a31..5b9e6ee489 100644 --- a/epan/to_str.c +++ b/epan/to_str.c @@ -589,9 +589,15 @@ display_signed_time(gchar *buf, int buflen, gint32 sec, gint32 frac, a "-" in front of the entire time stamp. */ if (frac < 0) { frac = -frac; - if (sec >= 0) - buf[0] = '-'; - ++buf; } + if (sec >= 0) { + if (buflen < 1) { + return; + } + buf[0] = '\0'; + buf++; + buflen--; + } + } switch (units) { case SECS: @@ -637,9 +643,14 @@ display_epoch_time(gchar *buf, int buflen, time_t sec, gint32 frac, a "-" in front of the entire time stamp. */ if (frac < 0) { frac = -frac; - if (elapsed_secs >= 0) - buf[0] = '-'; - ++buf; + if (elapsed_secs >= 0) { + if (buflen < 1) { + return; + } + buf[0] = '\0'; + buf++; + buflen--; + } } switch (units) { |