httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giuliano Gavazzi <dev-apache....@humph.com>
Subject Re: Meaning of len returned by apr_bucket_read()...
Date Fri, 19 Jan 2007 11:54:27 GMT

On 19 Jan 2007, at 11:24, Drew Bertola wrote:

>> if the data you read can contain nulls I would expect that. At the
>> same time, is it safe to call strlen on it? That is, is the data
>> always null terminated?
>
> That's the question.  I didn't mention this, and from your response it
> now seems important:  When I compare strlen(str) to len, len is either
> equal or less than the length of str.
>
> So, does len truly represent the data read, or does str?

ah, I thought your were finding strlen < len (because of nulls in *str)
 From reading the headers: len is the amount of data returned.
Since str is not null terminated, as you showed, sooner or later if  
you call strlen(str) you will hit an access violation.
But don't quote me on anything I wrote, I am not an expert in apr!
g

Mime
View raw message