OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 value = header_buffer + i + 1; | 247 value = header_buffer + i + 1; |
248 while (*value == ' ') { | 248 while (*value == ' ') { |
249 value++; | 249 value++; |
250 } | 250 } |
251 break; | 251 break; |
252 } | 252 } |
253 } | 253 } |
254 | 254 |
255 // Check that key is Content-Length. | 255 // Check that key is Content-Length. |
256 if (strcmp(key, kContentLength) == 0) { | 256 if (strcmp(key, kContentLength) == 0) { |
257 // Get the content length value if within a sensible range. | 257 // Get the content length value if present and within a sensible range. |
258 if (strlen(value) > 7) { | 258 if (value == NULL || strlen(value) > 7) { |
259 return SmartPointer<char>(); | 259 return SmartPointer<char>(); |
260 } | 260 } |
261 for (int i = 0; value[i] != '\0'; i++) { | 261 for (int i = 0; value[i] != '\0'; i++) { |
262 // Bail out if illegal data. | 262 // Bail out if illegal data. |
263 if (value[i] < '0' || value[i] > '9') { | 263 if (value[i] < '0' || value[i] > '9') { |
264 return SmartPointer<char>(); | 264 return SmartPointer<char>(); |
265 } | 265 } |
266 content_length = 10 * content_length + (value[i] - '0'); | 266 content_length = 10 * content_length + (value[i] - '0'); |
267 } | 267 } |
268 } else { | 268 } else { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 return total_received; | 409 return total_received; |
410 } | 410 } |
411 total_received += received; | 411 total_received += received; |
412 } | 412 } |
413 return total_received; | 413 return total_received; |
414 } | 414 } |
415 | 415 |
416 } } // namespace v8::internal | 416 } } // namespace v8::internal |
417 | 417 |
418 #endif // ENABLE_DEBUGGER_SUPPORT | 418 #endif // ENABLE_DEBUGGER_SUPPORT |
OLD | NEW |