summaryrefslogtreecommitdiff
path: root/wiretap/wtap_opttypes.c
diff options
context:
space:
mode:
Diffstat (limited to 'wiretap/wtap_opttypes.c')
-rw-r--r--wiretap/wtap_opttypes.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/wiretap/wtap_opttypes.c b/wiretap/wtap_opttypes.c
index 4ecc9bd7a0..7e3b4837c5 100644
--- a/wiretap/wtap_opttypes.c
+++ b/wiretap/wtap_opttypes.c
@@ -254,8 +254,14 @@ static guint32 wtap_optionblock_get_option_write_size(wtap_optionblock_t block)
length = value->info->write_size(&value->option);
options_total_length += length;
/* Add bytes for option header if option should be written */
- if (length > 0)
+ if (length > 0) {
+ /* Add optional padding to 32 bits */
+ if ((options_total_length & 0x03) != 0)
+ {
+ options_total_length += 4 - (options_total_length & 0x03);
+ }
options_total_length += 4;
+ }
}
}
@@ -529,8 +535,7 @@ guint32 wtap_opttype_write_uint8_not0(wtap_option_type* data)
if (data->uint8val == 0)
return 0;
- /* padding to 32 bits */
- return 4;
+ return 1;
}
gboolean wtap_opttype_write_data_uint8(struct wtap_dumper* wdh, wtap_option_type* data, int *err)