git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94965
13f79535-47bb-0310-9956-
ffa450edef68
if (rv != APR_SUCCESS) {
return rv;
}
- /* XXX Check for overflow */
- if (len ) {
- memcpy(cur, s, len);
- cur+=len;
- obj->count+=len;
+ if (len) {
+ /* Check for buffer overflow */
+ if ((obj->count + len) > mobj->m_len) {
+ return APR_ENOMEM;
+ }
+ else {
+ memcpy(cur, s, len);
+ cur+=len;
+ obj->count+=len;
+ }
}
/* This should not happen, but if it does, we are in BIG trouble
* cause we just stomped all over the heap.