Don't cast second argument of mem_printf_hook (%b) to size_t.
Also treat the given number as unsigned int. Due to the printf hook registration the second argument of mem_printf_hook (if called via printf etc.) is always of type int*. Casting this to a size_t pointer and then dereferencing that as int does not work on big endian machines if int is smaller than size_t (e.g. on ppc64). In order to make this change work if the argument is of a type larger than int, size_t for instance, the second argument for %b has to be casted to (u_)int.
This commit is contained in:
@@ -523,7 +523,7 @@ METHOD(generator_t, generate_payload, void,
|
||||
payload_type_names, payload_type);
|
||||
DBG3(DBG_ENC, "generated data for this payload %b",
|
||||
this->buffer + offset_start,
|
||||
this->out_position - this->buffer - offset_start);
|
||||
(u_int)(this->out_position - this->buffer - offset_start));
|
||||
}
|
||||
|
||||
METHOD(generator_t, destroy, void,
|
||||
|
||||
@@ -377,7 +377,7 @@ METHOD(parser_t, parse_payload, status_t,
|
||||
payload_type_names, payload_type, this->input_roof - this->byte_pos);
|
||||
|
||||
DBG3(DBG_ENC, "parsing payload from %b",
|
||||
this->byte_pos, this->input_roof - this->byte_pos);
|
||||
this->byte_pos, (u_int)(this->input_roof - this->byte_pos));
|
||||
|
||||
/* base pointer for output, avoids casting in every rule */
|
||||
output = pld;
|
||||
|
||||
Reference in New Issue
Block a user