mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
snmp: change uses of sprintf into snprintf
This commit is contained in:
parent
b1fd3477b2
commit
429f91d80d
1 changed files with 4 additions and 3 deletions
|
@ -528,7 +528,7 @@ retry:
|
||||||
buf2[0] = '\0';
|
buf2[0] = '\0';
|
||||||
count = rootlen;
|
count = rootlen;
|
||||||
while(count < vars->name_length){
|
while(count < vars->name_length){
|
||||||
sprintf(buf, "%lu.", vars->name[count]);
|
snprintf(buf, sizeof(buf), "%lu.", vars->name[count]);
|
||||||
strcat(buf2, buf);
|
strcat(buf2, buf);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
@ -873,8 +873,9 @@ static bool netsnmp_session_init(php_snmp_session **session_p, int version, zend
|
||||||
|
|
||||||
/* put back non-standard SNMP port */
|
/* put back non-standard SNMP port */
|
||||||
if (remote_port != SNMP_PORT) {
|
if (remote_port != SNMP_PORT) {
|
||||||
pptr = session->peername + strlen(session->peername);
|
size_t peername_length = strlen(session->peername);
|
||||||
sprintf(pptr, ":%d", remote_port);
|
pptr = session->peername + peername_length;
|
||||||
|
snprintf(pptr, MAX_NAME_LEN - peername_length, ":%d", remote_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
php_network_freeaddresses(psal);
|
php_network_freeaddresses(psal);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue