Harden message handling in the debugger agent.

This defect have been reported by the Coverity Prevent static analysis tool.
Review URL: http://codereview.chromium.org/160327

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2580 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
sgjesse@chromium.org 2009-07-30 07:02:23 +00:00
parent 98425a31f1
commit e13c319f7c

View File

@ -254,8 +254,8 @@ SmartPointer<char> DebuggerAgentUtil::ReceiveMessage(const Socket* conn) {
// Check that key is Content-Length.
if (strcmp(key, kContentLength) == 0) {
// Get the content length value if within a sensible range.
if (strlen(value) > 7) {
// Get the content length value if present and within a sensible range.
if (value == NULL || strlen(value) > 7) {
return SmartPointer<char>();
}
for (int i = 0; value[i] != '\0'; i++) {