[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] Strange char 0x7f added after last POST notification
From: |
Christian Grothoff |
Subject: |
Re: [libmicrohttpd] Strange char 0x7f added after last POST notification |
Date: |
Mon, 13 Apr 2020 10:59:54 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 |
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