Skip to content

Commit

Permalink
Changed strcpy to strncpy.
Browse files Browse the repository at this point in the history
Signed-off-by: Triveni Danda <[email protected]>
  • Loading branch information
D-Triveni committed Feb 23, 2024
1 parent 6ae3d65 commit f32527f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions zephyr/src/indigo_api_callback_dut.c
Original file line number Diff line number Diff line change
Expand Up @@ -1481,7 +1481,7 @@ static int set_ap_parameter_handler(struct packet_wrapper *req, struct packet_wr
tlv = find_wrapper_tlv_by_id(req, TLV_GAS_COMEBACK_DELAY);
}
if (tlv && find_tlv_config_name(tlv->id) != NULL) {
strcpy(param_name, find_tlv_config_name(tlv->id));
strncpy(param_name, find_tlv_config_name(tlv->id), sizeof(param_name));
memcpy(param_value, tlv->value, sizeof(param_value));
} else {
status = TLV_VALUE_STATUS_NOT_OK;
Expand Down Expand Up @@ -1798,7 +1798,7 @@ static int set_sta_parameter_handler(struct packet_wrapper *req, struct packet_w
memset(param_name, 0, sizeof(param_name));
memset(param_value, 0, sizeof(param_value));
tlv = req->tlv[i];
strcpy(param_name, find_tlv_config_name(tlv->id));
strncpy(param_name, find_tlv_config_name(tlv->id), sizeof(param_name));
memcpy(param_value, tlv->value, sizeof(param_value));

/* Assemble wpa_supplicant command */
Expand Down
10 changes: 5 additions & 5 deletions zephyr/src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -893,9 +893,9 @@ int set_hapd_exec_file(char* path) {
char *ptr = indigo_strrstr(path, "/");

if (ptr) {
strcpy(hapd_exec_file, ptr+1);
strncpy(hapd_exec_file, ptr+1, sizeof(hapd_exec_file));
} else {
strcpy(hapd_exec_file, path);
strncpy(hapd_exec_file, path, sizeof(hapd_exec_file));
}
return 0;
}
Expand Down Expand Up @@ -978,9 +978,9 @@ char* get_wpas_exec_file() {
int set_wpas_exec_file(char* path) {
char *ptr = indigo_strrstr(path, "/");
if (ptr) {
strcpy(wpas_exec_file, ptr+1);
strncpy(wpas_exec_file, ptr+1, sizeof(wpas_exec_file));
} else {
strcpy(wpas_exec_file, path);
strncpy(wpas_exec_file, path, sizeof(wpas_exec_file));
}
return 0;
}
Expand Down Expand Up @@ -1052,7 +1052,7 @@ int add_wireless_interface_info(int band, int bssid, char *name) {
interfaces[interface_count].band = band;
interfaces[interface_count].bssid = -1;
interfaces[interface_count].identifier = UNUSED_IDENTIFIER;
strcpy(interfaces[interface_count++].ifname, name);
strncpy(interfaces[interface_count++].ifname, name, sizeof(interfaces[interface_count].ifname));
return 0;
}

Expand Down

0 comments on commit f32527f

Please sign in to comment.