Use the minimum of the two string lengths for comparison

This commit is contained in:
Chris Robinson
2014-10-13 07:04:36 -07:00
parent 84582ceb03
commit 87dcf65013
+1 -1
View File
@@ -726,7 +726,7 @@ void al_string_clear(al_string *str)
static inline int al_string_compare(const al_string_char_type *str1, size_t str1len,
const al_string_char_type *str2, size_t str2len)
{
size_t complen = (str1len > str2len) ? str1len : str2len;
size_t complen = (str1len < str2len) ? str1len : str2len;
int ret = memcmp(str1, str2, complen);
if(ret == 0)
{