From: Michael Wallner Date: Wed, 24 Jan 2007 09:29:42 +0000 (+0000) Subject: - fix segvs with incompletely initialiezed HttpMessages X-Git-Tag: RELEASE_1_4_1~5 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=9ebfcd40b777ee7d69b0b422fd98342bee39e10a;p=m6w6%2Fext-http - fix segvs with incompletely initialiezed HttpMessages --- diff --git a/http_message_object.c b/http_message_object.c index 235ffc4..e2dbb56 100644 --- a/http_message_object.c +++ b/http_message_object.c @@ -905,7 +905,11 @@ PHP_METHOD(HttpMessage, getResponseStatus) if (return_value_used) { getObject(http_message_object, obj); HTTP_CHECK_MESSAGE_TYPE_RESPONSE(obj->message, RETURN_FALSE); - RETURN_STRING(obj->message->http.info.response.status, 1); + if (obj->message->http.info.response.status) { + RETURN_STRING(obj->message->http.info.response.status, 1); + } else { + RETURN_EMPTY_STRING(); + } } } /* }}} */ @@ -923,7 +927,7 @@ PHP_METHOD(HttpMessage, setResponseStatus) if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &status, &status_len)) { RETURN_FALSE; } - STR_SET(obj->message->http.info.response.status, estrdup(status)); + STR_SET(obj->message->http.info.response.status, estrndup(status, status_len)); RETURN_TRUE; } /* }}} */ @@ -937,7 +941,11 @@ PHP_METHOD(HttpMessage, getRequestMethod) if (return_value_used) { getObject(http_message_object, obj); HTTP_CHECK_MESSAGE_TYPE_REQUEST(obj->message, RETURN_FALSE); - RETURN_STRING(obj->message->http.info.request.method, 1); + if (obj->message->http.info.request.method) { + RETURN_STRING(obj->message->http.info.request.method, 1); + } else { + RETURN_EMPTY_STRING(); + } } } /* }}} */ @@ -978,7 +986,11 @@ PHP_METHOD(HttpMessage, getRequestUrl) if (return_value_used) { getObject(http_message_object, obj); HTTP_CHECK_MESSAGE_TYPE_REQUEST(obj->message, RETURN_FALSE); - RETURN_STRING(obj->message->http.info.request.url, 1); + if (obj->message->http.info.request.url) { + RETURN_STRING(obj->message->http.info.request.url, 1); + } else { + RETURN_EMPTY_STRING(); + } } } /* }}} */