[coreboot-gerrit] Change in coreboot[master]: arch/x86/smbios: fix whitespace trimming

Matt DeVillier (Code Review) gerrit at coreboot.org
Mon May 28 05:17:12 CEST 2018


Matt DeVillier has uploaded this change for review. ( https://review.coreboot.org/26597


Change subject: arch/x86/smbios: fix whitespace trimming
......................................................................

arch/x86/smbios: fix whitespace trimming

Currently, the whitespace trimmer will only remove whitespace
at the end of a string/buffer when the length of the buffer is
exactly buffer_size. In practice, strlen(buffer) is often less
than buffer_size, so the function needs to look past any null
terminator until the first printable character is reached.

Test: pass in a buffer with trailing whitespace with length
less than buffer_size, observe whitespace correctly trimmed.

Change-Id: Ic9e458f3072ed0496cbdd37c60567d5331afd42f
Signed-off-by: Matt DeVillier <matt.devillier at gmail.com>
---
M src/arch/x86/smbios.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/97/26597/1

diff --git a/src/arch/x86/smbios.c b/src/arch/x86/smbios.c
index 25a41b5..70aa1f2 100644
--- a/src/arch/x86/smbios.c
+++ b/src/arch/x86/smbios.c
@@ -204,7 +204,7 @@
 		return;
 
 	for (char *p = buffer + len - 1; p >= buffer; --p) {
-		if (*p == ' ')
+		if (*p <= ' ')
 			*p = 0;
 		else
 			break;

-- 
To view, visit https://review.coreboot.org/26597
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic9e458f3072ed0496cbdd37c60567d5331afd42f
Gerrit-Change-Number: 26597
Gerrit-PatchSet: 1
Gerrit-Owner: Matt DeVillier <matt.devillier at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180528/6a326cba/attachment.html>


More information about the coreboot-gerrit mailing list