Giuliano Gavazzi wrote: >> >> apr_bucket_read(b, &str, &len, APR_NONBLOCK_READ); >> >> and follow that with: >> >> fprintf(stderr, "strlen(str): %d, len: %d\n", strlen(str), len); >> >> I see that strlen(str) and len are not always the same. Why? > > 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? -- Drew
