diff options
author | Joe Orton <jorton@apache.org> | 2004-09-21 23:07:23 +0200 |
---|---|---|
committer | Joe Orton <jorton@apache.org> | 2004-09-21 23:07:23 +0200 |
commit | 2b26d10798e3218c819fdd8cceaca4d43854c39c (patch) | |
tree | 03ede681c17218355a5a01fdc50ec63b68c07330 /server | |
parent | * configure.in: Only export CC and CPP if a cache file is not (diff) | |
download | apache2-2b26d10798e3218c819fdd8cceaca4d43854c39c.tar.xz apache2-2b26d10798e3218c819fdd8cceaca4d43854c39c.zip |
* server/protocol.c (ap_rgetline_core): Never NUL terminate at
(*s)[-1] for caller-supplied *s.
Submitted by: Rici Lake <ricilake speedy.com.pe>
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@105231 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server')
-rw-r--r-- | server/protocol.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/server/protocol.c b/server/protocol.c index d3576c1405..81904a40a5 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -252,12 +252,12 @@ AP_DECLARE(apr_status_t) ap_rgetline_core(char **s, apr_size_t n, if (n < bytes_handled + len) { *read = bytes_handled; if (*s) { - /* ensure this string is terminated */ - if (bytes_handled < n) { + /* ensure this string is NUL terminated */ + if (bytes_handled > 0) { (*s)[bytes_handled-1] = '\0'; } else { - (*s)[n-1] = '\0'; + (*s)[0] = '\0'; } } return APR_ENOSPC; |