]> granicus.if.org Git - php/commitdiff
calculate length of cookie string correctly
authorSascha Schumann <sas@php.net>
Sun, 12 Sep 1999 12:27:11 +0000 (12:27 +0000)
committerSascha Schumann <sas@php.net>
Sun, 12 Sep 1999 12:27:11 +0000 (12:27 +0000)
ext/session/session.c

index 51edab86d8a6ecb1ec2273efe3807a251f4f702c..b87dfb9233c06c1a95642cf56c31434f5fa467c5 100644 (file)
@@ -76,7 +76,7 @@ PHP_INI_BEGIN()
        PHP_INI_ENTRY("session.serialize_handler", "php", PHP_INI_ALL, NULL)
        PHP_INI_ENTRY("session.extern_referer_check", "", PHP_INI_ALL, NULL)
        PHP_INI_ENTRY("session.entropy_file", "", PHP_INI_ALL, NULL)
-       PHP_INI_ENTRY("session.entropy_length", "", PHP_INI_ALL, NULL)
+       PHP_INI_ENTRY("session.entropy_length", "0", PHP_INI_ALL, NULL)
 PHP_INI_END()
 
 PS_SERIALIZER_FUNCS(php);
@@ -374,10 +374,11 @@ static void _php_session_send_cookie(PSLS_D)
        }
        cookie = ecalloc(len + 1, 1);
        
-       snprintf(cookie, len, COOKIE_FMT, PS(session_name), PS(id));
+       len = snprintf(cookie, len, COOKIE_FMT, PS(session_name), PS(id));
        if (PS(lifetime) > 0) {
                strcat(cookie, COOKIE_EXPIRES);
                strcat(cookie, date_fmt);
+               len += strlen(COOKIE_EXPIRES) + strlen(date_fmt);
                efree(date_fmt);
        }