/[Apache-SVN]
ViewVC logotype

Revision 1904675


Jump to revision: Previous Next
Author: ylavic
Date: Tue Oct 18 07:38:51 2022 UTC (18 months ago)
Changed paths: 6
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.


Changed paths

Path Details
Directoryapr/apr/branches/1.7.x/ modified , props changed
Directoryapr/apr/branches/1.7.x/encoding/apr_encode.c modified , text changed
Directoryapr/apr/branches/1.7.x/encoding/apr_escape.c modified , text changed
Directoryapr/apr/branches/1.7.x/include/apr_encode.h modified , text changed
Directoryapr/apr/branches/1.7.x/include/private/apr_encode_private.h modified , text changed
Directoryapr/apr/branches/1.7.x/test/testencode.c modified , text changed

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26