From 81885eea475c4842a57f090eb5029ac6d3683916 Mon Sep 17 00:00:00 2001 From: "thestig@chromium.org" Date: Fri, 9 Nov 2012 19:15:06 +0000 Subject: [PATCH] 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 --- src/client/linux/minidump_writer/minidump_writer.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/client/linux/minidump_writer/minidump_writer.cc b/src/client/linux/minidump_writer/minidump_writer.cc index 5a0f8c14..4167b1bc 100644 --- a/src/client/linux/minidump_writer/minidump_writer.cc +++ b/src/client/linux/minidump_writer/minidump_writer.cc @@ -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'; } }