(php_addslashes) Fixed stop condition - it should only take into account

the length of the string, not the characters.
This commit is contained in:
Andrei Zmievski 2000-07-21 15:29:59 +00:00
parent 4773b98ac6
commit fbced1b9cc

View File

@ -1706,7 +1706,8 @@ PHPAPI char *php_addslashes(char *str, int length, int *new_length, int should_f
return str;
}
new_str = (char *) emalloc((length?length:(length=strlen(str)))*2+1);
for (source=str,end=source+length,target=new_str; (c = *source) || source<end; source++) {
for (source=str,end=source+length,target=new_str; source<end; source++) {
c = *source;
switch(c) {
case '\0':
*target++ = '\\';