jorton 2004/09/23 11:18:36
Modified: server Tag: APACHE_2_0_BRANCH protocol.c
Log:
Backport from HEAD:
* server/protocol.c (ap_rgetline_core): Never NUL terminate at
(*s)[-1] for caller-supplied *s.
Submitted by: Rici Lake <ricilake speedy.com.pe>
Reviewed by: jorton, jerenkrantz, trawick
Revision Changes Path
No revision
No revision
1.121.2.21 +3 -3 httpd-2.0/server/protocol.c
Index: protocol.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/protocol.c,v
retrieving revision 1.121.2.20
retrieving revision 1.121.2.21
diff -d -w -u -r1.121.2.20 -r1.121.2.21
--- protocol.c 15 Sep 2004 10:47:56 -0000 1.121.2.20
+++ protocol.c 23 Sep 2004 18:18:36 -0000 1.121.2.21
@@ -251,12 +251,12 @@
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;
|