update for null-termination of strings fix

master
Andre Puschmann 7 years ago
parent aa6699e25f
commit f3b1fe0f1a

@ -111,7 +111,7 @@ void parse_args(int argc, char **argv) {
cfi = atoi(argv[optind]);
break;
case 'x':
strncpy(mimo_type_str, argv[optind], sizeof(mimo_type_str));
strncpy(mimo_type_str, argv[optind], sizeof(mimo_type_str)-1);
mimo_type_str[sizeof(mimo_type_str)-1] = 0;
break;
case 'p':

@ -715,7 +715,7 @@ int enb::parse_sib9(std::string filename, LIBLTE_RRC_SYS_INFO_BLOCK_TYPE_9_STRUC
if (!parser::parse_section(filename, &sib9)) {
data->hnb_name_present = true;
if (name_enabled) {
strncpy((char*) data->hnb_name, hnb_name.c_str(), 48);
strncpy((char*) data->hnb_name, hnb_name.c_str(), 47);
data->hnb_name[47] = 0;
data->hnb_name_size = strnlen(hnb_name.c_str(), 48);
} else if (hex_enabled) {

@ -201,7 +201,7 @@ srslte::error_t gw::init_if(char *err_str)
}
memset(&ifr, 0, sizeof(ifr));
ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
strncpy(ifr.ifr_ifrn.ifrn_name, dev, IFNAMSIZ);
strncpy(ifr.ifr_ifrn.ifrn_name, dev, IFNAMSIZ-1);
ifr.ifr_ifrn.ifrn_name[IFNAMSIZ-1] = 0;
if(0 > ioctl(tun_fd, TUNSETIFF, &ifr))
{

Loading…
Cancel
Save