comparison http.c @ 1027:2803b7076c83

Checked the length arg when appending data.
author bertrand
date Tue, 05 Jun 2001 08:46:31 +0000
parents ede5785faa53
children
comparison
equal deleted inserted replaced
1026:435feedf9f89 1027:2803b7076c83
38 } 38 }
39 39
40 int 40 int
41 http_response_append( HTTP_header_t *http_hdr, char *response, int length ) { 41 http_response_append( HTTP_header_t *http_hdr, char *response, int length ) {
42 char *ptr = NULL; 42 char *ptr = NULL;
43 if( http_hdr==NULL || response==NULL ) return -1; 43 if( http_hdr==NULL || response==NULL || length<0 ) return -1;
44 ptr = (char*)malloc( http_hdr->buffer_size+length ); 44 ptr = (char*)malloc( http_hdr->buffer_size+length );
45 if( ptr==NULL ) { 45 if( ptr==NULL ) {
46 printf("Memory allocation failed\n"); 46 printf("Memory allocation failed\n");
47 return -1; 47 return -1;
48 } 48 }