]> granicus.if.org Git - php/commitdiff
Avoid running off the end of a non-null terminated string. Not that we
authorRasmus Lerdorf <rasmus@php.net>
Thu, 24 May 2007 20:53:05 +0000 (20:53 +0000)
committerRasmus Lerdorf <rasmus@php.net>
Thu, 24 May 2007 20:53:05 +0000 (20:53 +0000)
should have any of those, but a mistake in an extension could hit this
and the check doesn't actually make any sense as far as I am concerned.

ext/standard/string.c

index 56981b077866602c9a1521fcda207e9fe500d7b0..1255e8c4d836d20a863daccc426104aac5c5e048 100644 (file)
@@ -3016,7 +3016,7 @@ PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int should_
 
        php_charmask(what, wlength, flags TSRMLS_CC);
 
-       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++) {
                if (flags[(unsigned char)c]) {
                        if ((unsigned char) c < 32 || (unsigned char) c > 126) {
                                *target++ = '\\';