summaryrefslogtreecommitdiff
path: root/payloads/libpayload
diff options
context:
space:
mode:
authorPatrick Georgi <patrick.georgi@coresystems.de>2010-08-16 18:04:13 +0000
committerPatrick Georgi <patrick.georgi@coresystems.de>2010-08-16 18:04:13 +0000
commit154931c66fcc70424a10f3c99f63e361538cd888 (patch)
tree47d18f8a6417f27a612863597708ebf512378360 /payloads/libpayload
parent1457aad00b38b4745ba564b6cc803ff98c128ea2 (diff)
downloadcoreboot-154931c66fcc70424a10f3c99f63e361538cd888.tar.xz
Fix strcmp and strncmp. They failed in several important scenarios
Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de> Acked-by: Patrick Georgi <patrick.georgi@coresystems.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5700 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'payloads/libpayload')
-rw-r--r--payloads/libpayload/libc/string.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/payloads/libpayload/libc/string.c b/payloads/libpayload/libc/string.c
index 1ca8bc12e8..7bf19ace37 100644
--- a/payloads/libpayload/libc/string.c
+++ b/payloads/libpayload/libc/string.c
@@ -91,7 +91,7 @@ int strcasecmp(const char *s1, const char *s2)
{
int i;
- for (i = 0; 1; i++) {
+ for (i = 0; s1[i] != '\0'; i++) {
if (tolower(s1[i]) != tolower(s2[i]))
return s1[i] - s2[i];
}
@@ -116,7 +116,7 @@ int strncasecmp(const char *s1, const char *s2, size_t maxlen)
return s1[i] - s2[i];
}
- return 0;
+ return s1[i] - s2[i];
}
/**
@@ -132,12 +132,12 @@ int strcmp(const char *s1, const char *s2)
{
int i;
- for (i = 0; 1; i++) {
+ for (i = 0; s1[i] != '\0'; i++) {
if (s1[i] != s2[i])
return s1[i] - s2[i];
}
- return 0;
+ return s1[i] - s2[i];
}
/**