Skip to content

Commit 61dc29b

Browse files
committed
lib: rstrcmp: Added null terminator check for comapring cstring of different lengths.
Signed-off-by: Michal Jerzy Wierzbicki <michalx.wierzbicki@linux.intel.com>
1 parent ae793d2 commit 61dc29b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/lib/lib.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ int rstrcmp(const char *s1, const char *s2)
119119
s2++;
120120
}
121121

122+
/* did both string end */
123+
if (*s1 != 0)
124+
return 1;
125+
if (*s2 != 0)
126+
return -1;
127+
122128
/* match */
123129
return 0;
124130
}

0 commit comments

Comments
 (0)