when exiting with APR_ENOSPC
Submitted by: Tsurutani Naoki <turutani scphys.kyoto-u.ac.jp>
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103482
13f79535-47bb-0310-9956-
ffa450edef68
/* Would this overrun our buffer? If so, we'll die. */
if (n < bytes_handled + len) {
*read = bytes_handled;
+ if (*s) {
+ /* ensure this string is terminated */
+ if (bytes_handled < n) {
+ (*s)[bytes_handled] = '\0';
+ }
+ else {
+ (*s)[n-1] = '\0';
+ }
+ }
return APR_ENOSPC;
}
/* Do we have enough space? We may be full now. */
if (bytes_handled >= n) {
*read = n;
+ /* ensure this string is terminated */
+ (*s)[n-1] = '\0';
return APR_ENOSPC;
}
else {