diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2002-11-23 03:19:39 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2002-11-23 03:19:39 +0000 |
commit | e10463537d048652918a61d5561fa055fca44ad6 (patch) | |
tree | 650ac357b9cd877680124b5096f1a0a6d1d8cab5 /file.c | |
parent | 3760f74f57b42c02fb5a51cda90a572a99b67ef9 (diff) |
From Tomas Kukosa: adjust the pointer into the line buffer if the line
buffer gets reallocated.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@6665 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1,7 +1,7 @@ /* file.c * File I/O routines * - * $Id: file.c,v 1.293 2002/10/17 02:11:19 guy Exp $ + * $Id: file.c,v 1.294 2002/11/23 03:19:39 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1100,6 +1100,7 @@ print_packets(capture_file *cf, print_args_t *print_args) char *line_buf = NULL; int line_buf_len = 256; char *cp; + int cp_off; int column_len; int line_len; epan_dissect_t *edt = NULL; @@ -1144,8 +1145,10 @@ print_packets(capture_file *cf, print_args_t *print_args) double its length. */ line_len += column_len + 1; /* "+1" for space */ if (line_len > line_buf_len) { + cp_off = cp - line_buf; line_buf_len *= 2; line_buf = g_realloc(line_buf, line_buf_len + 1); + cp = line_buf + cp_off; } /* Right-justify the packet number column. */ @@ -1240,8 +1243,10 @@ print_packets(capture_file *cf, print_args_t *print_args) double its length. */ line_len += column_len + 1; /* "+1" for space */ if (line_len > line_buf_len) { + cp_off = cp - line_buf; line_buf_len *= 2; line_buf = g_realloc(line_buf, line_buf_len + 1); + cp = line_buf + cp_off; } /* Right-justify the packet number column. */ |