On 4/13/20 2:11 AM, Imóveis Nacionais wrote: > Then when in the "*upload_data_size = 0" situation, using a printf > sometimes I can see that the thread context data has the 0x7f char appended > and of course the strlen now is one char extra. This happens between the > last post call with *upload_data_size > 0 and *upload_data_size = 0. > > Does this char has any meaning in the libmicrohttpd context? > Why is this char being added?
You're seeing undefined behavior. When '*upload_data_size' is zero, you are not allowed to look into '*upload_data'. It is NEVER warranted to be a 0-terminated char* in the first place, and right now you're just reading data out of bounds. Do not rely on getting 0x7f or anything meaningful, in fact, expect reading more than '*upload_data_size' bytes from '*upload_data' to be deadly. Happy hacking! Christian
signature.asc
Description: OpenPGP digital signature