diff options
author | Chris Maynard <Christopher.Maynard@GTECH.COM> | 2013-11-15 22:31:11 +0000 |
---|---|---|
committer | Chris Maynard <Christopher.Maynard@GTECH.COM> | 2013-11-15 22:31:11 +0000 |
commit | bde2a9493b8e74e98cd3babbcc9fdf364634c69f (patch) | |
tree | 76030b77807c214b16967313a3d59f35a519d16e /editcap.c | |
parent | d3033d3ab886a145b45cc78cdffc997d2e1bec3a (diff) |
Fix chopping when offset is 0. Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9422
svn path=/trunk/; revision=53345
Diffstat (limited to 'editcap.c')
-rw-r--r-- | editcap.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -178,7 +178,7 @@ static nstime_t previous_time = {0, 0}; /* previous time */ static int find_dct2000_real_data(guint8 *buf); static void handle_chopping(chop_t chop, struct wtap_pkthdr *out_phdr, - const struct wtap_pkthdr *in_phdr, guint8 *buf, + const struct wtap_pkthdr *in_phdr, guint8 **buf, gboolean adjlen); static gchar * @@ -1327,7 +1327,7 @@ main(int argc, char *argv[]) /* CHOP */ snap_phdr = *phdr; - handle_chopping(chop, &snap_phdr, phdr, buf, adjlen); + handle_chopping(chop, &snap_phdr, phdr, &buf, adjlen); phdr = &snap_phdr; /* Do we adjust timestamps to ensure strict chronological @@ -1642,7 +1642,7 @@ find_dct2000_real_data(guint8 *buf) */ static void handle_chopping(chop_t chop, struct wtap_pkthdr *out_phdr, - const struct wtap_pkthdr *in_phdr, guint8 *buf, + const struct wtap_pkthdr *in_phdr, guint8 **buf, gboolean adjlen) { /* If we're not chopping anything from one side, then the offset for that @@ -1694,11 +1694,11 @@ handle_chopping(chop_t chop, struct wtap_pkthdr *out_phdr, *out_phdr = *in_phdr; if (chop.off_begin_pos > 0) { - memmove(&buf[chop.off_begin_pos], - &buf[chop.off_begin_pos + chop.len_begin], + memmove(*buf + chop.off_begin_pos, + *buf + chop.off_begin_pos + chop.len_begin, out_phdr->caplen - chop.len_begin); } else { - buf += chop.len_begin; + *buf += chop.len_begin; } out_phdr->caplen -= chop.len_begin; @@ -1717,8 +1717,8 @@ handle_chopping(chop_t chop, struct wtap_pkthdr *out_phdr, *out_phdr = *in_phdr; if (chop.off_end_neg < 0) { - memmove(&buf[(gint)out_phdr->caplen + (chop.len_end + chop.off_end_neg)], - &buf[(gint)out_phdr->caplen + chop.off_end_neg], + memmove(*buf + (gint)out_phdr->caplen + (chop.len_end + chop.off_end_neg), + *buf + (gint)out_phdr->caplen + chop.off_end_neg, -chop.off_end_neg); } out_phdr->caplen += chop.len_end; |