diff options
author | drh <drh@noemail.net> | 2013-03-01 01:07:17 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2013-03-01 01:07:17 +0000 |
commit | 503a686e09ce03995eef5d9a95ef217532575be5 (patch) | |
tree | 11602fc697bab83aa85d31324c8abb24189560c8 /src/test_regexp.c | |
parent | 016fff2b6eacbf1335e105f430bcd741d771d7f4 (diff) | |
download | sqlite-503a686e09ce03995eef5d9a95ef217532575be5.tar.gz sqlite-503a686e09ce03995eef5d9a95ef217532575be5.zip |
Always use strncmp() rather than memcmp() when comparing strings where one
or other string might be less than the length parameter, since optimized
versions of memcmp() might read past the first difference and in so doing
generate an access violation.
FossilOrigin-Name: d73435587ba7459e2e2c32980d0e17abdeceb4bc
Diffstat (limited to 'src/test_regexp.c')
-rw-r--r-- | src/test_regexp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test_regexp.c b/src/test_regexp.c index 321417b88..2cebbea44 100644 --- a/src/test_regexp.c +++ b/src/test_regexp.c @@ -194,7 +194,7 @@ int re_match(ReCompiled *pRe, const unsigned char *zIn, int nIn){ if( pRe->nInit ){ unsigned char x = pRe->zInit[0]; while( in.i+pRe->nInit<=in.mx - && (zIn[in.i]!=x || memcmp(zIn+in.i, pRe->zInit, pRe->nInit)!=0) + && (zIn[in.i]!=x || strncmp(zIn+in.i, pRe->zInit, pRe->nInit)!=0) ){ in.i++; } |