Skip to content

Commit

Permalink
more snprintf()
Browse files Browse the repository at this point in the history
  • Loading branch information
tony2001 committed Jan 18, 2007
1 parent 7cef744 commit 3570dcc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions ext/soap/soap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2134,7 +2134,7 @@ PHP_METHOD(SoapServer, handle)
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Dump memory failed");
}

sprintf(cont_len, "Content-Length: %d", size);
snprintf(cont_len, sizeof(cont_len), "Content-Length: %d", size);
sapi_add_header(cont_len, strlen(cont_len), 1);
if (soap_version == SOAP_1_2) {
sapi_add_header("Content-Type: application/soap+xml; charset=utf-8", sizeof("Content-Type: application/soap+xml; charset=utf-8")-1, 1);
Expand Down Expand Up @@ -2303,7 +2303,7 @@ static void soap_server_fault_ex(sdlFunctionPtr function, zval* fault, soapHeade
our fault code with their own handling... Figure this out later
*/
sapi_add_header("HTTP/1.1 500 Internal Service Error", sizeof("HTTP/1.1 500 Internal Service Error")-1, 1);
sprintf(cont_len,"Content-Length: %d", size);
snprintf(cont_len, sizeof(cont_len), "Content-Length: %d", size);
sapi_add_header(cont_len, strlen(cont_len), 1);
if (soap_version == SOAP_1_2) {
sapi_add_header("Content-Type: application/soap+xml; charset=utf-8", sizeof("Content-Type: application/soap+xml; charset=utf-8")-1, 1);
Expand Down Expand Up @@ -4706,7 +4706,7 @@ static xmlNodePtr serialize_parameter(sdlParamPtr param, zval *param_val, int in
} else {
if (name == NULL) {
paramName = paramNameBuf;
sprintf(paramName,"param%d",index);
snprintf(paramName, sizeof(paramNameBuf), "param%d",index);
} else {
paramName = name;
}
Expand Down
4 changes: 2 additions & 2 deletions ext/standard/html.c
Original file line number Diff line number Diff line change
Expand Up @@ -1427,12 +1427,12 @@ PHP_FUNCTION(get_html_translation_table)
cp = (UChar)(i + entity_map[j].basechar);
key_len = zend_codepoint_to_uchar(cp, key);
key[key_len] = 0;
sprintf(buffer, "&%s;", entity_map[j].table[i]);
snprintf(buffer, sizeof(buffer), "&%s;", entity_map[j].table[i]);
add_u_assoc_ascii_string_ex(return_value, IS_UNICODE, ZSTR(key), key_len+1, buffer, 1);
} else {
/* no wide chars here, because charset is always cs_8859_1 */
ind[0] = i + entity_map[j].basechar;
sprintf(buffer, "&%s;", entity_map[j].table[i]);
snprintf(buffer, sizeof(buffer), "&%s;", entity_map[j].table[i]);
add_assoc_string(return_value, ind, buffer, 1);
}
}
Expand Down
4 changes: 2 additions & 2 deletions ext/wddx/wddx.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ static void php_wddx_serialize_object(wddx_packet *packet, zval *obj)
PHP_SET_CLASS_ATTRIBUTES(obj);

php_wddx_add_chunk_static(packet, WDDX_STRUCT_S);
sprintf(tmp_buf, WDDX_VAR_S, PHP_CLASS_NAME_VAR);
snprintf(tmp_buf, WDDX_BUF_LEN, WDDX_VAR_S, PHP_CLASS_NAME_VAR);
php_wddx_add_chunk(packet, tmp_buf);
php_wddx_add_chunk_static(packet, WDDX_STRING_S);
php_wddx_add_chunk_ex(packet, class_name.s, name_len);
Expand Down Expand Up @@ -481,7 +481,7 @@ static void php_wddx_serialize_object(wddx_packet *packet, zval *obj)
PHP_SET_CLASS_ATTRIBUTES(obj);

php_wddx_add_chunk_static(packet, WDDX_STRUCT_S);
sprintf(tmp_buf, WDDX_VAR_S, PHP_CLASS_NAME_VAR);
snprintf(tmp_buf, WDDX_BUF_LEN, WDDX_VAR_S, PHP_CLASS_NAME_VAR);
php_wddx_add_chunk(packet, tmp_buf);
php_wddx_add_chunk_static(packet, WDDX_STRING_S);
php_wddx_add_chunk_ex(packet, class_name.s, name_len);
Expand Down

0 comments on commit 3570dcc

Please sign in to comment.