Linux: Avoid truncating the vendor id.

Review URL: https://breakpad.appspot.com/495002

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1079 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
thestig@chromium.org 2012-11-09 19:15:06 +00:00
parent d45abdd839
commit 81885eea47

View file

@ -1250,12 +1250,10 @@ class MinidumpWriter {
size_t length = my_strlen(value);
if (length == 0)
goto popline;
my_strlcpy(vendor_id, value, sizeof(vendor_id));
// we don't want the trailing newline
if (value[length - 1] == '\n')
length--;
// ensure we have space for the value
if (length < sizeof(vendor_id))
my_strlcpy(vendor_id, value, length);
if (length < sizeof(vendor_id) && vendor_id[length - 1] == '\n')
vendor_id[length - 1] == '\0';
}
}