check length
This commit is contained in:
parent
ceb615335b
commit
33eea25926
1 changed files with 3 additions and 3 deletions
|
@ -41,15 +41,15 @@ char * inside_slug(char * needle, int needle_len, char *offset) {
|
||||||
char * s1 = offset;
|
char * s1 = offset;
|
||||||
char * s2 = offset;
|
char * s2 = offset;
|
||||||
|
|
||||||
while( s1 >= needle ) {
|
while( s1 >= needle && (s1 - needle < needle_len) ) {
|
||||||
if ( *s1 == '{' ) {
|
if ( *s1 == '{' ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
s1--;
|
s1--;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *end = needle+ needle_len;
|
char * end = needle + needle_len;
|
||||||
while( s2 < end ) {
|
while( (s2 + 1) < end ) {
|
||||||
if ( *s2 == '}' ) {
|
if ( *s2 == '}' ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue