]> granicus.if.org Git - php/commitdiff
Make sure len is defined here
authorRasmus Lerdorf <rasmus@php.net>
Mon, 3 Jun 2002 18:26:27 +0000 (18:26 +0000)
committerRasmus Lerdorf <rasmus@php.net>
Mon, 3 Jun 2002 18:26:27 +0000 (18:26 +0000)
ext/standard/html.c

index cf933df0a18a8c82fbb839019286fdc9652171df..12eafcde6f1afd1c536dc9097b0b291911f5145d 100644 (file)
@@ -526,7 +526,7 @@ static enum entity_charset determine_charset(char *charset_hint)
 {
        int i;
        enum entity_charset charset = cs_8859_1;
-       int len;
+       int len = 0;
 
        /* Guarantee default behaviour for backwards compatibility */
        if (charset_hint == NULL)
@@ -573,6 +573,7 @@ static enum entity_charset determine_charset(char *charset_hint)
 #endif
        }
        if (charset_hint)       {
+               if(!len) len = strlen(charset_hint);
                /* now walk the charset map and look for the codeset */
                for (i = 0; charset_map[i].codeset; i++)        {
                        if (strncasecmp(charset_hint, charset_map[i].codeset, len) == 0)        {