aboutsummaryrefslogtreecommitdiffstats
path: root/epan/to_str.c
diff options
context:
space:
mode:
authorgerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>2009-07-17 15:59:24 +0000
committergerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>2009-07-17 15:59:24 +0000
commitb9233fc77ebda0f4d703b922ce01cb85c00eae07 (patch)
tree597e3bfa43df7685371f81548450c68a8fcf9144 /epan/to_str.c
parentd71a8f16e963138c439286a04cead2bda6235cc1 (diff)
Fix an ep buffer overrun introduced in r29130.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@29133 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/to_str.c')
-rw-r--r--epan/to_str.c23
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) {