Fix some "bad file" messages.

The number being compared against is the amount of data *remaining* in
the comment information, not the *size* of the comment information.

And it's unsigned, so format it with %u.

Change-Id: I5f02302ad4acbc3b27655ff5518e6e56d464020d
Reviewed-on: https://code.wireshark.org/review/28280
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2018-06-14 21:01:57 -07:00
parent 7f3d7199fb
commit 1e84591f4f
1 changed files with 2 additions and 2 deletions

View File

@ -702,7 +702,7 @@ wtap_open_return_val netmon_open(wtap *wth, int *err, gchar **err_info)
}
if (pletoh32(&comment_header.titleLength) > comment_table_size) {
*err = WTAP_ERR_BAD_FILE;
*err_info = g_strdup_printf("netmon: comment title size is %u, which is larger than the entire comment section (%d)",
*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);
g_hash_table_destroy(comment_table);
return WTAP_OPEN_ERROR;
@ -755,7 +755,7 @@ wtap_open_return_val netmon_open(wtap *wth, int *err, gchar **err_info)
/* Make sure comment size is sane */
if (comment_rec->descLength > comment_table_size) {
*err = WTAP_ERR_BAD_FILE;
*err_info = g_strdup_printf("netmon: comment description size is %u, which is larger than the entire comment section (%d)",
*err_info = g_strdup_printf("netmon: comment description size is %u, which is larger than the amount remaining in the comment section (%u)",
comment_rec->descLength, comment_table_size);
g_hash_table_destroy(comment_table);
return WTAP_OPEN_ERROR;