Log Message: |
encoding: Better check inputs of apr_{encode,decode}_* functions.
Check that the given sources can be encoded without overflowing.
Return APR_EINVAL if the given "slen" is negative, APR_NOTFOUND if "dest" is
not NULL and "src" is NULL, or APR_ENOSPC if "dest" is NULL and the source
length (based on "slen" or APR_ENCODE_STRING) is too big to encode.
* include/private/apr_encode_private.h():
Rename ENCODE_TO_ASCII() and ENCODE_TO_NATIVE() to respectively TO_ASCII()
and TO_ENCODE(), and make them return an unsigned char.
* encoding/apr_escape.c():
Use the new TO_ASCII() and TO_NATIVE().
* encoding/apr_encode.c(apr_encode_*, apr_decode_*):
Forbid negative "slen" but APR_ENCODE_STRING, and use apr_size_t arithmetics
to check for overflows when encoding.
When "dest" is NULL, "src" can be NULL too.
Better check for trailing '='s or base16's APR_ENCODE_COLON ':' separators.
Rename ENCODE_TO_ASCII and ENCODE_TO_NATIVE to their new names, and remove
casts to (unsigned char) now unnecessary.
* include/apr_encode.h():
Update dox about acceptable inputs and returned errors.
* test/testencode.c():
Tests for error conditions.
testencode: Follow up to r1902281: error tests for apr_decode_base16_binary.
testencode: Follow up to r1902281: Correct call convention for encdec_fn.
testencode: Follow up to r1902281: Correct call convention for encdec_fn (try 2).
testencode: Follow up to r1902281: Inline, no calling convention assumptions.
Merges r1902281, r1902282, r1902284, r1902285, r1902286 from trunk.
|