René Scharfe <rene.scharfe@xxxxxxxxxxxxxx> writes: >> - >> - } else { /* Classic exact string match */ >> - /* Yes, I've heard of strstr(), but the thing is *data may >> - * not be NUL terminated. Sue me. >> - */ >> + } else { >> + /* data many not be NUL terminated; we cannot use strstr() */ > > That looks fishy to me. regexec() expects data to be a NUL-terminated > string, so either the comment is wrong or the regexp case needs to take > better care to add a NUL at the end of the buffer. Probably yes, but regexp side is not my code and I never use it, so... ;-) > In any case, there is also memmem(), which uses the same fast algorithm > as strstr() in recent glibc versions. Like this? Thanks; it would be nice to bench this change. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html