aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-06-14 21:07:52 -0700
committerGuy Harris <guy@alum.mit.edu>2018-06-15 04:08:24 +0000
commit08ef8f1326b8206a7234c70d836b90d9ed778676 (patch)
tree4c6c640868f8c9e1f8a78c3af7ce6090989c4048 /wiretap
parent1e84591f4f07dc712bee9be3a33508a5510bb357 (diff)
Just extract the title length once.
Extract it into title_length before checking it, and then check the value of title_length. Change-Id: I7f2c334dbce5eeaa12cd5d8bb8e289852fd15c4f Reviewed-on: https://code.wireshark.org/review/28282 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/netmon.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/wiretap/netmon.c b/wiretap/netmon.c
index 34ea6efdcf..54ec96734c 100644
--- a/wiretap/netmon.c
+++ b/wiretap/netmon.c
@@ -694,16 +694,17 @@ wtap_open_return_val netmon_open(wtap *wth, int *err, gchar **err_info)
comment_table_size -= 12;
/* Make sure comment size is sane */
- if (pletoh32(&comment_header.titleLength) == 0) {
+ title_length = pletoh32(&comment_header.titleLength);
+ if (title_length == 0) {
*err = WTAP_ERR_BAD_FILE;
*err_info = g_strdup("netmon: comment title size can't be 0");
g_hash_table_destroy(comment_table);
return WTAP_OPEN_ERROR;
}
- if (pletoh32(&comment_header.titleLength) > comment_table_size) {
+ if (title_length > comment_table_size) {
*err = WTAP_ERR_BAD_FILE;
*err_info = g_strdup_printf("netmon: comment title size is %u, which is larger than the amount remaining in the comment section (%u)",
- pletoh32(&comment_header.titleLength), comment_table_size);
+ title_length, comment_table_size);
g_hash_table_destroy(comment_table);
return WTAP_OPEN_ERROR;
}
@@ -711,7 +712,6 @@ wtap_open_return_val netmon_open(wtap *wth, int *err, gchar **err_info)
comment_rec = g_new0(struct netmonrec_comment, 1);
comment_rec->numFramePerComment = pletoh32(&comment_header.numFramePerComment);
comment_rec->frameOffset = pletoh32(&comment_header.frameOffset);
- title_length = pletoh32(&comment_header.titleLength);
g_hash_table_insert(comment_table, GUINT_TO_POINTER(comment_rec->frameOffset), comment_rec);