]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* server/protocol.c (ap_rgetline_core): Never NUL terminate at
authorJoe Orton <jorton@apache.org>
Tue, 21 Sep 2004 21:07:23 +0000 (21:07 +0000)
committerJoe Orton <jorton@apache.org>
Tue, 21 Sep 2004 21:07:23 +0000 (21:07 +0000)
(*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

server/protocol.c

index d3576c140544936315b7bbb4c7af2c987e41dbf2..81904a40a5e093b9363ebc48570e885bbe1905df 100644 (file)
@@ -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;