From c5f93282d7885a6c5f80863cbee2ab55a3176851 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Mon, 12 Jan 2009 09:43:06 +0000 Subject: [PATCH] fix bug#15495 HttpMessage::setHttpVersion segfault --- http_message_object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/http_message_object.c b/http_message_object.c index d01c256..81f31a4 100644 --- a/http_message_object.c +++ b/http_message_object.c @@ -1132,9 +1132,9 @@ PHP_METHOD(HttpMessage, setHttpVersion) } convert_to_double(zv); - sprintf(v, "%1.1lf", Z_DVAL_P(zv)); + snprintf(v, sizeof(v), "%1.1f", Z_DVAL_P(zv)); if (strcmp(v, "1.0") && strcmp(v, "1.1")) { - http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, "Invalid HTTP protocol version (1.0 or 1.1): %s", v); + http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, "Invalid HTTP protocol version (1.0 or 1.1): %g", Z_DVAL_P(zv)); RETURN_FALSE; } -- 2.30.2