]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r1933342 from trunk:
authorEric Covener <covener@apache.org>
Sun, 26 Apr 2026 15:50:50 +0000 (15:50 +0000)
committerEric Covener <covener@apache.org>
Sun, 26 Apr 2026 15:50:50 +0000 (15:50 +0000)
fix ajp_msg_get_string buffer checks

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1933343 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/ajp_msg.c

index 36533c59059ef35e77f66dae917b5af7bf1d8f4f..3d4186a521c0f6cf191dc20ff8273b9d451f09d2 100644 (file)
@@ -507,7 +507,12 @@ apr_status_t ajp_msg_get_string(ajp_msg_t *msg, const char **rvalue)
     status = ajp_msg_get_uint16(msg, &size);
     start = msg->pos;
 
-    if ((status != APR_SUCCESS) || (size + start > msg->max_size)) {
+    if ((status != APR_SUCCESS) || (size + start >= msg->len)) {
+        return ajp_log_overflow(msg, "ajp_msg_get_string");
+    }
+
+    /* Verify that the expected null terminator is actually present */
+    if (msg->buf[start + size] != '\0') {
         return ajp_log_overflow(msg, "ajp_msg_get_string");
     }