From a91d72a9413be0ae4185d7ea4be69218677ad107 Mon Sep 17 00:00:00 2001 From: "jvoung@chromium.org" Date: Fri, 15 Feb 2013 20:28:41 +0000 Subject: Fix strcmp bug in pnacl_shim. The original fails thinking a == b when substr(a,b). Oops! Seen in ppb_testing_dev version 0.9 vs 0.91. BUG=https://code.google.com/p/nativeclient/issues/detail?id=2484 TEST=browser_test --gtest_filter=*PNaCl* Review URL: https://chromiumcodereview.appspot.com/12230049 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182811 0039d316-1c4b-4281-b951-d872f2087c98 --- ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'ppapi/native_client') diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c index 036d9c6..62d984a 100644 --- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c +++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c @@ -114,8 +114,14 @@ /* Use local strcmp to avoid dependency on libc. */ static int mystrcmp(const char* s1, const char *s2) { - while((*s1 && *s2) && (*s1++ == *s2++)); - return *(--s1) - *(--s2); + while (1) { + if (*s1 == 0) break; + if (*s2 == 0) break; + if (*s1 != *s2) break; + ++s1; + ++s2; + } + return *(s1) - *(s2); } /* BEGIN Declarations for all Wrapper Infos */ -- cgit v1.1