]> granicus.if.org Git - php/commitdiff
more snprintf()
authorAntony Dovgal <tony2001@php.net>
Thu, 18 Jan 2007 16:21:00 +0000 (16:21 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 18 Jan 2007 16:21:00 +0000 (16:21 +0000)
ext/soap/soap.c
ext/standard/html.c
ext/wddx/wddx.c

index 5edda73a93ba924c34c79ff10e9b1a97977f8b4c..88bb04ef085a1b76e456f646488ad0dd51c09927 100644 (file)
@@ -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);
@@ -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);
@@ -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;
                }
index 120b5411f1bc2dd0a3a98b5a6888d3d4c9b6706b..30770f2dc2cb0e850bab2927ce8c87fdf72f25eb 100644 (file)
@@ -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);
                                        }
                                }
index 960b59322692d7ee185015cf76c96431881329af..1dc21e0ca9ef287767cb4818457dd3b630a37f4d 100644 (file)
@@ -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);
@@ -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);