if (strlen(cmd) + strlen(args) + 4 > FTP_BUFSIZE) {
return 0;
}
- size = snprintf(ftp->outbuf, sizeof(ftp->outbuf), "%s %s\r\n", cmd, args);
+ size = slprintf(ftp->outbuf, sizeof(ftp->outbuf), "%s %s\r\n", cmd, args);
} else {
/* "cmd\r\n\0" */
if (strlen(cmd) + 3 > FTP_BUFSIZE) {
return 0;
}
- size = snprintf(ftp->outbuf, sizeof(ftp->outbuf), "%s\r\n", cmd);
+ size = slprintf(ftp->outbuf, sizeof(ftp->outbuf), "%s\r\n", cmd);
}
data = ftp->outbuf;
for(zend_hash_internal_pointer_reset_ex(&php_hash_hashtable, &pos);
(type = zend_hash_get_current_key_ex(&php_hash_hashtable, &str, NULL, &idx, 0, &pos)) != HASH_KEY_NON_EXISTANT;
zend_hash_move_forward_ex(&php_hash_hashtable, &pos)) {
- s += snprintf(s, e - s, "%s ", str);
+ s += slprintf(s, e - s, "%s ", str);
}
*s = 0;
va_init_list(args, fmt);
n = vsnprintf((char* )buf, bufsize, (const char* )fmt, args);
+ if (n >= bufsize) {
+ return;
+ }
va_end(args);
need = (pat_end - pat) * 4 + 4;
for (i=0; i<n; i++) {
if ((name = mhash_get_hash_name(i))) {
- l = snprintf(buf, 127, "MHASH_%s", name);
+ l = slprintf(buf, 127, "MHASH_%s", name);
zend_register_long_constant(buf, l + 1, i, CONST_PERSISTENT, module_number TSRMLS_CC);
free(name);
}
while ((nextfile = readdirectory(dir)) != NULL)
{
int frc, blen;
- blen = snprintf(buffer, sizeof(buffer), "%.512s%c%.128s", pathname, sep, nextfile);
+ blen = slprintf(buffer, sizeof(buffer), "%.512s%c%.128s", pathname, sep, nextfile);
if (exclude_compiled != NULL &&
pcre_exec(exclude_compiled, NULL, buffer, blen, 0, 0, NULL, 0) >= 0)
/* loop through all the provided arguments and set dpb fields accordingly */
for (i = 0; i < sizeof(dpb_flags); ++i) {
if (dpb_values[i] && buf_len > 0) {
- dpb_len = snprintf(dpb, buf_len, "%c%c%s", dpb_flags[i], (unsigned char)strlen(dpb_values[i]),
+ dpb_len = slprintf(dpb, buf_len, "%c%c%s", dpb_flags[i], (unsigned char)strlen(dpb_values[i]),
dpb_values[i]);
dpb += dpb_len;
buf_len -= dpb_len;
return FAILURE;
}
- if (!(euid_len = snprintf(euid, sizeof(euid), "%d", geteuid()))) {
+ if (!(euid_len = slprintf(euid, sizeof(euid), "%d", geteuid()))) {
return FAILURE;
}
php_gmtime_r(when, &tm);
- n = snprintf(buf, sizeof(buf), "%s, %02d %s %d %02d:%02d:%02d GMT", /* SAFE */
+ n = slprintf(buf, sizeof(buf), "%s, %02d %s %d %02d:%02d:%02d GMT", /* SAFE */
week_days[tm.tm_wday], tm.tm_mday,
month_names[tm.tm_mon], tm.tm_year + 1900,
tm.tm_hour, tm.tm_min,
intern->file_name = "php://memory";
intern->file_name_len = 12;
} else if (ZEND_NUM_ARGS()) {
- intern->file_name_len = snprintf(tmp_fname, sizeof(tmp_fname), "php://temp/maxmemory:%ld", max_memory);
+ intern->file_name_len = slprintf(tmp_fname, sizeof(tmp_fname), "php://temp/maxmemory:%ld", max_memory);
intern->file_name = tmp_fname;
} else {
intern->file_name = "php://temp";
if (intern->u.regex.flags & REGIT_USE_KEY) {
if (intern->current.key_type == HASH_KEY_IS_LONG) {
- subject_len = snprintf(tmp, sizeof(tmp), "%ld", intern->current.int_key);
+ subject_len = slprintf(tmp, sizeof(tmp), "%ld", intern->current.int_key);
subject = &tmp[0];
use_copy = 0;
} else {
if (entity_map[j].table[k - entity_map[j].basechar] == NULL)
continue;
- entity_length = snprintf(entity, sizeof(entity), "&%s;", entity_map[j].table[k - entity_map[j].basechar]);
+ entity_length = slprintf(entity, sizeof(entity), "&%s;", entity_map[j].table[k - entity_map[j].basechar]);
if (entity_length >= sizeof(entity)) {
continue;
}
/* ensure the header is only sent if user_agent is not blank */
if (ua_len > sizeof(_UA_HEADER)) {
ua = emalloc(ua_len + 1);
- if ((ua_len = snprintf(ua, ua_len, _UA_HEADER, ua_str)) > 0) {
+ if ((ua_len = slprintf(ua, ua_len, _UA_HEADER, ua_str)) > 0) {
ua[ua_len] = 0;
php_stream_write(stream, ua, ua_len);
} else {
php_stream_context_get_option(context, "http", "content", &tmpzval) == SUCCESS &&
Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval) > 0) {
if (!(have_header & HTTP_HEADER_CONTENT_LENGTH)) {
- scratch_len = snprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRLEN_PP(tmpzval));
+ scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRLEN_PP(tmpzval));
php_stream_write(stream, scratch, scratch_len);
}
if (!(have_header & HTTP_HEADER_TYPE)) {
case IS_LONG: {
char stmp[MAX_LENGTH_OF_LONG + 1];
- str_len = snprintf(stmp, sizeof(stmp), "%ld", Z_LVAL_PP(tmp));
+ str_len = slprintf(stmp, sizeof(stmp), "%ld", Z_LVAL_PP(tmp));
smart_str_appendl(&implstr, stmp, str_len);
}
break;
switch (hash_type) {
case HASH_KEY_IS_LONG:
- key_length = snprintf(tmp, sizeof(tmp), "%ld", idx) + 1;
+ key_length = slprintf(tmp, sizeof(tmp), "%ld", idx) + 1;
key = tmp;
/* fallthru */
case HASH_KEY_IS_STRING:
zend_unmangle_property_name(key, key_len-1, &class_name, &prop_name);
php_wddx_serialize_var(packet, *ent, prop_name, strlen(prop_name)+1 TSRMLS_CC);
} else {
- key_len = snprintf(tmp_buf, sizeof(tmp_buf), "%ld", idx);
+ key_len = slprintf(tmp_buf, sizeof(tmp_buf), "%ld", idx);
php_wddx_serialize_var(packet, *ent, tmp_buf, key_len TSRMLS_CC);
}
}
if (ent_type == HASH_KEY_IS_STRING) {
php_wddx_serialize_var(packet, *ent, key, key_len TSRMLS_CC);
} else {
- key_len = snprintf(tmp_buf, sizeof(tmp_buf), "%ld", idx);
+ key_len = slprintf(tmp_buf, sizeof(tmp_buf), "%ld", idx);
php_wddx_serialize_var(packet, *ent, tmp_buf, key_len TSRMLS_CC);
}
} else
/* If there is no realm string at all, append one */
if(!strstr(lower_temp,"realm")) {
efree(result);
- conv_len = snprintf(conv_temp, sizeof(conv_temp), " realm=\"%ld\"",myuid);
+ conv_len = slprintf(conv_temp, sizeof(conv_temp), " realm=\"%ld\"",myuid);
result = emalloc(ptr_len+conv_len+1);
result_len = ptr_len+conv_len;
memcpy(result, ptr, ptr_len);
assert(Z_STRVAL_P(uf_result) != NULL);
- len = snprintf(buf, sizeof(buf), "Content-Encoding: %s", Z_STRVAL_P(uf_result));
+ len = slprintf(buf, sizeof(buf), "Content-Encoding: %s", Z_STRVAL_P(uf_result));
if (len <= 0 || sapi_add_header(buf, len, 1) == FAILURE) {
return FAILURE;
}
http_status_line.header_len = strlen(SG(sapi_headers).http_status_line);
} else {
http_status_line.header = buf;
- http_status_line.header_len = snprintf(buf, sizeof(buf), "HTTP/1.0 %d X", SG(sapi_headers).http_response_code);
+ http_status_line.header_len = slprintf(buf, sizeof(buf), "HTTP/1.0 %d X", SG(sapi_headers).http_response_code);
}
sapi_module.send_header(&http_status_line, SG(server_context) TSRMLS_CC);
}
int len;
if (CGIG(rfc2616_headers) && SG(sapi_headers).http_status_line) {
- len = snprintf(buf, SAPI_CGI_MAX_HEADER_LENGTH,
+ len = slprintf(buf, SAPI_CGI_MAX_HEADER_LENGTH,
"%s\r\n", SG(sapi_headers).http_status_line);
if (len > SAPI_CGI_MAX_HEADER_LENGTH) {
}
} else {
- len = snprintf(buf, sizeof(buf), "Status: %d\r\n", SG(sapi_headers).http_response_code);
+ len = slprintf(buf, sizeof(buf), "Status: %d\r\n", SG(sapi_headers).http_response_code);
}
PHPWRITE_H(buf, len);
#endif
#if !HAVE_SETENV
if (value) {
- len = snprintf(buf, len - 1, "%s=%s", name, value);
+ len = slprintf(buf, len - 1, "%s=%s", name, value);
putenv(buf);
}
#endif
#if !HAVE_UNSETENV
if (!value) {
- len = snprintf(buf, len - 1, "%s=", name);
+ len = slprintf(buf, len - 1, "%s=", name);
putenv(buf);
}
#endif
for (j = 0; j < sizeof(fcgi_mgmt_vars)/sizeof(fcgi_mgmt_vars[0]); j++) {
if (zend_hash_exists(&req->env, fcgi_mgmt_vars[j].name, fcgi_mgmt_vars[j].name_len+1) == 0) {
- sprintf((char*)p, "%c%c%s%c", fcgi_mgmt_vars[j].name_len, 1, fcgi_mgmt_vars[j].name, fcgi_mgmt_vars[j].val);
- p += fcgi_mgmt_vars[j].name_len + 3;
+ sprintf((char*)p, "%c%c%s%c", fcgi_mgmt_vars[j].name_len, 1, fcgi_mgmt_vars[j].name, fcgi_mgmt_vars[j].val);
+ p += fcgi_mgmt_vars[j].name_len + 3;
}
}
len = p - buf - sizeof(fcgi_header);
status_line = malloc(30);
/* safe sprintf use */
- len = snprintf(status_line, 30, "HTTP/1.1 %d NA\r\n", SG(sapi_headers).http_response_code);
+ len = slprintf(status_line, 30, "HTTP/1.1 %d NA\r\n", SG(sapi_headers).http_response_code);
vec[0].iov_base = status_line;
vec[0].iov_len = len;
sapi_header_line ctr = {0};
ctr.line = buf;
- ctr.line_len = snprintf(buf, sizeof(buf), "Server: %s", TUXAPI_version);
+ ctr.line_len = slprintf(buf, sizeof(buf), "Server: %s", TUXAPI_version);
sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC);
php_register_variable("PHP_SELF", SG(request_info).request_uri, track_vars_array TSRMLS_CC);