From 667c7a3b23e154254a4b91286cbb0f6aedf4c410 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Mon, 29 Sep 2014 10:12:29 +0200 Subject: util/fletcher: fix debug option parsing sizeof(char[]-type+1) isn't very useful. Since one of the strings is constant, we also don't need to use strncmp that string's length. While at it, str*cmp don't return booleans, so check for value instead of faux bools. Change-Id: Iebb194a60eac454dafeade75f135df92068cf4ab Found-by: Coverity Scan Signed-off-by: Patrick Georgi Reviewed-on: http://review.coreboot.org/6988 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan --- util/fletcher/fletcher.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/fletcher') diff --git a/util/fletcher/fletcher.c b/util/fletcher/fletcher.c index 3147d50376..a5724943aa 100644 --- a/util/fletcher/fletcher.c +++ b/util/fletcher/fletcher.c @@ -111,7 +111,7 @@ int main(int argc, char **argv) checksum = fletcher32(&buffer[2], filesize/2 - 2); *((uint32_t *)& buffer[2]) = checksum; #ifndef DEBUG - if ((argc == 2) && !strncmp(argv[1], debugoption, sizeof(debugoption+1))) { + if ((argc == 2) && (strcmp(argv[1], debugoption) == 0)) { #endif fprintf(stderr, "Fletcher's Checksum: %x\n", checksum); #ifndef DEBUG -- cgit v1.2.3