* 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
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/APACHE_2_0_BRANCH@105278
13f79535-47bb-0310-9956-
ffa450edef68
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;