Author: oxygene
Date: Mon Aug 16 20:04:13 2010
New Revision: 5700
URL: https://tracker.coreboot.org/trac/coreboot/changeset/5700

Log:
Fix strcmp and strncmp. They failed in several important scenarios

Signed-off-by: Patrick Georgi <[email protected]>
Acked-by: Patrick Georgi <[email protected]>

Modified:
   trunk/payloads/libpayload/libc/string.c

Modified: trunk/payloads/libpayload/libc/string.c
==============================================================================
--- trunk/payloads/libpayload/libc/string.c     Mon Aug 16 19:51:47 2010        
(r5699)
+++ trunk/payloads/libpayload/libc/string.c     Mon Aug 16 20:04:13 2010        
(r5700)
@@ -91,7 +91,7 @@
 {
        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 @@
                        return s1[i] - s2[i];
        }
 
-       return 0;
+       return s1[i] - s2[i];
 }
 
 /**
@@ -132,12 +132,12 @@
 {
        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];
 }
 
 /**

-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to