summaryrefslogtreecommitdiff
path: root/main/SAPI.c
diff options
context:
space:
mode:
authorMoriyoshi Koizumi <moriyoshi@php.net>2003-02-10 20:18:08 +0000
committerMoriyoshi Koizumi <moriyoshi@php.net>2003-02-10 20:18:08 +0000
commit6d95ea199d7f94adac61eab6d2a38a114e9c7973 (patch)
tree74a413ed7ace2355d2b7d020ec4093023bfff1ef /main/SAPI.c
parent9450b1e4b09e93e144fffa4cbc37eec88f727b3d (diff)
downloadphp-git-6d95ea199d7f94adac61eab6d2a38a114e9c7973.tar.gz
Fixed possible snprintf problem
# besides snprintf returns int value, not uint / size_t...
Diffstat (limited to 'main/SAPI.c')
-rw-r--r--main/SAPI.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/main/SAPI.c b/main/SAPI.c
index 9657ba3a3f..dedd65c462 100644
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@ -720,12 +720,12 @@ SAPI_API int sapi_send_headers(TSRMLS_D)
if (call_user_function_ex(CG(function_table), NULL, &nm_zlib_get_coding_type, &uf_result, 0, NULL, 1, NULL TSRMLS_CC) != FAILURE && uf_result != NULL && Z_TYPE_P(uf_result) == IS_STRING) {
char buf[128];
- uint len;
+ int len;
assert(Z_STRVAL_P(uf_result) != NULL);
len = snprintf(buf, sizeof(buf), "Content-Encoding: %s", Z_STRVAL_P(uf_result));
- if (sapi_add_header(buf, len, 1)==FAILURE) {
+ if (len <= 0 || sapi_add_header(buf, len, 1) == FAILURE) {
return FAILURE;
}
if (sapi_add_header("Vary: Accept-Encoding", sizeof("Vary: Accept-Encoding") - 1, 1) == FAILURE) {