[systemd-sonic-generator] replace sscanf with strtol (#15357)
#### Why I did it Avoid 'sscanf()' for number conversions. Its use can lead to undefined behavior, slow processing, and integer overflows. Instead prefer the 'strto*()' family of functions. #### How I did it replace sscanf with strtol #### How to verify it Manual test
This commit is contained in:
parent
475fe27c0b
commit
fca3458ae7
@ -569,7 +569,7 @@ int get_num_of_asic() {
|
|||||||
str_num_asic = strtok_r(NULL, "=", &saveptr);
|
str_num_asic = strtok_r(NULL, "=", &saveptr);
|
||||||
strip_trailing_newline(str_num_asic);
|
strip_trailing_newline(str_num_asic);
|
||||||
if (str_num_asic != NULL){
|
if (str_num_asic != NULL){
|
||||||
sscanf(str_num_asic, "%d",&num_asic);
|
num_asic = strtol(str_num_asic, NULL, 10);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user