summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/string.c2
-rw-r--r--src/tests/string_test.c1
2 files changed, 2 insertions, 1 deletions
diff --git a/src/core/string.c b/src/core/string.c
index c35015b59..188fe0864 100644
--- a/src/core/string.c
+++ b/src/core/string.c
@@ -116,7 +116,7 @@ int memcmp ( const void *first, const void *second, size_t len ) {
int diff;
while ( len-- ) {
- diff = ( *(second_bytes++) - *(first_bytes++) );
+ diff = ( *(first_bytes++) - *(second_bytes++) );
if ( diff )
return diff;
}
diff --git a/src/tests/string_test.c b/src/tests/string_test.c
index a66501da3..88a730aec 100644
--- a/src/tests/string_test.c
+++ b/src/tests/string_test.c
@@ -109,6 +109,7 @@ static void string_test_exec ( void ) {
ok ( memcmp ( "", "", 0 ) == 0 );
ok ( memcmp ( "Foo", "Foo", 3 ) == 0 );
ok ( memcmp ( "Foo", "Bar", 3 ) != 0 );
+ ok ( memcmp ( "abc", "def", 3 ) < 0 );
/* Test strstr() */
{