]> granicus.if.org Git - php/commitdiff
(php_addslashes) Fixed stop condition - it should only take into account
authorAndrei Zmievski <andrei@php.net>
Fri, 21 Jul 2000 15:29:59 +0000 (15:29 +0000)
committerAndrei Zmievski <andrei@php.net>
Fri, 21 Jul 2000 15:29:59 +0000 (15:29 +0000)
the length of the string, not the characters.

ext/standard/string.c

index dd761f1da092ff35a9d2af2b8bf44f6691368976..c8217b8ace5a21d3aeb66d688ec203403664e5c2 100644 (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++ = '\\';