[mod_snom, mod_snmp] Replace strncpy with snprintf
This commit is contained in:
parent
2a8804af97
commit
d127eeeecc
|
@ -143,7 +143,7 @@ SWITCH_STANDARD_API(snom_command_api_function)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switch_inet_pton(AF_INET, argv[0], &ip)) {
|
if (switch_inet_pton(AF_INET, argv[0], &ip)) {
|
||||||
strncpy(host, argv[0], sizeof(host));
|
snprintf(host, sizeof(host), "%s", argv[0]);
|
||||||
} else {
|
} else {
|
||||||
char *sql = NULL;
|
char *sql = NULL;
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
|
|
|
@ -79,22 +79,22 @@ static int channelList_callback(void *pArg, int argc, char **argv, char **column
|
||||||
row->data = entry;
|
row->data = entry;
|
||||||
|
|
||||||
entry->idx = idx++;
|
entry->idx = idx++;
|
||||||
strncpy(entry->uuid, switch_str_nil(argv[0]), sizeof(entry->uuid));
|
snprintf(entry->uuid, sizeof(entry->uuid), "%s", switch_str_nil(argv[0]));
|
||||||
strncpy(entry->direction, switch_str_nil(argv[1]), sizeof(entry->direction));
|
snprintf(entry->direction, sizeof(entry->direction), "%s", switch_str_nil(argv[1]));
|
||||||
entry->created_epoch = atoi(argv[3]);
|
entry->created_epoch = atoi(argv[3]);
|
||||||
strncpy(entry->name, switch_str_nil(argv[4]), sizeof(entry->name));
|
snprintf(entry->name, sizeof(entry->name), "%s", switch_str_nil(argv[4]));
|
||||||
strncpy(entry->state, switch_str_nil(argv[5]), sizeof(entry->state));
|
snprintf(entry->state, sizeof(entry->state), "%s", switch_str_nil(argv[5]));
|
||||||
strncpy(entry->cid_name, switch_str_nil(argv[6]), sizeof(entry->cid_name));
|
snprintf(entry->cid_name, sizeof(entry->cid_name), "%s", switch_str_nil(argv[6]));
|
||||||
strncpy(entry->cid_num, switch_str_nil(argv[7]), sizeof(entry->cid_num));
|
snprintf(entry->cid_num, sizeof(entry->cid_num), "%s", switch_str_nil(argv[7]));
|
||||||
strncpy(entry->dest, switch_str_nil(argv[9]), sizeof(entry->dest));
|
snprintf(entry->dest, sizeof(entry->dest), "%s", switch_str_nil(argv[9]));
|
||||||
strncpy(entry->application, switch_str_nil(argv[10]), sizeof(entry->application));
|
snprintf(entry->application, sizeof(entry->application), "%s", switch_str_nil(argv[10]));
|
||||||
strncpy(entry->application_data, switch_str_nil(argv[11]), sizeof(entry->application_data));
|
snprintf(entry->application_data, sizeof(entry->application_data), "%s", switch_str_nil(argv[11]));
|
||||||
strncpy(entry->dialplan, switch_str_nil(argv[12]), sizeof(entry->dialplan));
|
snprintf(entry->dialplan, sizeof(entry->dialplan), "%s", switch_str_nil(argv[12]));
|
||||||
strncpy(entry->context, switch_str_nil(argv[13]), sizeof(entry->context));
|
snprintf(entry->context, sizeof(entry->context), "%s", switch_str_nil(argv[13]));
|
||||||
strncpy(entry->read_codec, switch_str_nil(argv[14]), sizeof(entry->read_codec));
|
snprintf(entry->read_codec, sizeof(entry->read_codec), "%s", switch_str_nil(argv[14]));
|
||||||
entry->read_rate = atoi(switch_str_nil(argv[15]));
|
entry->read_rate = atoi(switch_str_nil(argv[15]));
|
||||||
entry->read_bitrate = atoi(switch_str_nil(argv[16]));
|
entry->read_bitrate = atoi(switch_str_nil(argv[16]));
|
||||||
strncpy(entry->write_codec, switch_str_nil(argv[17]), sizeof(entry->write_codec));
|
snprintf(entry->write_codec, sizeof(entry->write_codec), "%s", switch_str_nil(argv[17]));
|
||||||
entry->write_rate = atoi(switch_str_nil(argv[18]));
|
entry->write_rate = atoi(switch_str_nil(argv[18]));
|
||||||
entry->write_bitrate = atoi(switch_str_nil(argv[19]));
|
entry->write_bitrate = atoi(switch_str_nil(argv[19]));
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ int handle_identity(netsnmp_mib_handler *handler, netsnmp_handler_registration *
|
||||||
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &version, strlen(version));
|
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &version, strlen(version));
|
||||||
break;
|
break;
|
||||||
case ID_UUID:
|
case ID_UUID:
|
||||||
strncpy(uuid, switch_core_get_uuid(), sizeof(uuid));
|
snprintf(uuid, sizeof(uuid), "%s", switch_core_get_uuid());
|
||||||
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &uuid, strlen(uuid));
|
snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &uuid, strlen(uuid));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue