From: Michael Wallner Date: Mon, 12 Jan 2009 09:43:06 +0000 (+0000) Subject: fix bug#15495 HttpMessage::setHttpVersion segfault X-Git-Tag: RELEASE_1_7_0b1~8 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=commitdiff_plain;h=c5f93282d7885a6c5f80863cbee2ab55a3176851 fix bug#15495 HttpMessage::setHttpVersion segfault --- 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; }