]> granicus.if.org Git - php/commitdiff
Fix for cases when new_length is NULL
authorMarcus Boerger <helly@php.net>
Tue, 22 Oct 2002 18:27:56 +0000 (18:27 +0000)
committerMarcus Boerger <helly@php.net>
Tue, 22 Oct 2002 18:27:56 +0000 (18:27 +0000)
ext/standard/string.c

index ddd0bce2e93c63a009fc0935a53f47b0f8033525..0c4a09c5ed4c5b6257f52ced2dc77d1c4e0df600 100644 (file)
@@ -2422,7 +2422,11 @@ PHPAPI char *php_addslashes(char *str, int length, int *new_length, int should_f
        char *new_str;
        char *source, *target;
        char *end;
-       
+       int local_new_length;
+               
+       if (!new_length) {
+               new_length = &local_new_length;
+       }
        if (!str) {
                *new_length = 0;
                return str;
@@ -2471,9 +2475,7 @@ PHPAPI char *php_addslashes(char *str, int length, int *new_length, int should_f
        }
        
        *target = 0;
-       if (new_length) {
-               *new_length = target - new_str;
-       }
+       *new_length = target - new_str;
        if (should_free) {
                STR_FREE(str);
        }