They could match different strings as equal if the chunk was shorter
than the string. Those functions are currently only used for SSL's
certificate DN entry extract.
int diff = 0;
do {
- if (--len < 0)
+ if (--len < 0) {
+ diff = (unsigned char)0 - (unsigned char)*str;
break;
+ }
diff = (unsigned char)*(s1++) - (unsigned char)*(str++);
} while (!diff);
return diff;
int diff = 0;
do {
- if (--len < 0)
+ if (--len < 0) {
+ diff = (unsigned char)0 - (unsigned char)*str;
break;
+ }
diff = (unsigned char)*s1 - (unsigned char)*str;
if (unlikely(diff)) {
unsigned int l = (unsigned char)*s1;