mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-25 18:40:19 -04:00
Fix wide-character buffer size parameters in mingwapp.c snwprintf calls to prevent stack buffer overflow
This commit is contained in:
parent
6ed860eac3
commit
7aff21e3a9
1 changed files with 9 additions and 9 deletions
|
|
@ -898,9 +898,9 @@ static int devsmart(uint64_t device, const char* name, const char* smartctl, con
|
|||
if (smartctl[0]) {
|
||||
char option[SMART_MAX];
|
||||
snprintf(option, sizeof(option), smartctl, file);
|
||||
snwprintf(cmd, sizeof(cmd), L"\"%lssmartctl.exe\" %s %s", windows_exedir(), info_opts, option);
|
||||
snwprintf(cmd, sizeof(cmd) / sizeof(cmd[0]), L"\"%lssmartctl.exe\" %s %s", windows_exedir(), info_opts, option);
|
||||
} else {
|
||||
snwprintf(cmd, sizeof(cmd), L"\"%lssmartctl.exe\" %s %s", windows_exedir(), info_opts, file);
|
||||
snwprintf(cmd, sizeof(cmd) / sizeof(cmd[0]), L"\"%lssmartctl.exe\" %s %s", windows_exedir(), info_opts, file);
|
||||
}
|
||||
|
||||
count = 0;
|
||||
|
|
@ -956,7 +956,7 @@ retry:
|
|||
&& info[INFO_ROTATION_RATE] == SMART_UNASSIGNED
|
||||
) {
|
||||
/* retry using the "sat" type */
|
||||
snwprintf(cmd, sizeof(cmd), L"\"%lssmartctl.exe\" %s -d sat %s", windows_exedir(), info_opts, file);
|
||||
snwprintf(cmd, sizeof(cmd) / sizeof(cmd[0]), L"\"%lssmartctl.exe\" %s -d sat %s", windows_exedir(), info_opts, file);
|
||||
|
||||
++count;
|
||||
goto retry;
|
||||
|
|
@ -1222,9 +1222,9 @@ static int devprobe(uint64_t device, const char* name, const char* smartctl, con
|
|||
if (smartctl[0]) {
|
||||
char option[SMART_MAX];
|
||||
snprintf(option, sizeof(option), smartctl, file);
|
||||
snwprintf(cmd, sizeof(cmd), L"\"%lssmartctl.exe\" -n standby,3 %s %s", windows_exedir(), info_opts, option);
|
||||
snwprintf(cmd, sizeof(cmd) / sizeof(cmd[0]), L"\"%lssmartctl.exe\" -n standby,3 %s %s", windows_exedir(), info_opts, option);
|
||||
} else {
|
||||
snwprintf(cmd, sizeof(cmd), L"\"%lssmartctl.exe\" -n standby,3 %s %s", windows_exedir(), info_opts, file);
|
||||
snwprintf(cmd, sizeof(cmd) / sizeof(cmd[0]), L"\"%lssmartctl.exe\" -n standby,3 %s %s", windows_exedir(), info_opts, file);
|
||||
}
|
||||
|
||||
count = 0;
|
||||
|
|
@ -1273,7 +1273,7 @@ retry:
|
|||
*/
|
||||
if (ret == 2) {
|
||||
/* retry using the "sat" type */
|
||||
snwprintf(cmd, sizeof(cmd), L"\"%lssmartctl.exe\" -n standby,3 %s -d sat %s", windows_exedir(), info_opts, file);
|
||||
snwprintf(cmd, sizeof(cmd) / sizeof(cmd[0]), L"\"%lssmartctl.exe\" -n standby,3 %s -d sat %s", windows_exedir(), info_opts, file);
|
||||
|
||||
++count;
|
||||
goto retry;
|
||||
|
|
@ -1313,9 +1313,9 @@ static int devdown(uint64_t device, const char* name, const char* smartctl)
|
|||
if (smartctl[0]) {
|
||||
char option[SMART_MAX];
|
||||
snprintf(option, sizeof(option), smartctl, file);
|
||||
snwprintf(cmd, sizeof(cmd), L"\"%lssmartctl.exe\" -s standby,now %s", windows_exedir(), option);
|
||||
snwprintf(cmd, sizeof(cmd) / sizeof(cmd[0]), L"\"%lssmartctl.exe\" -s standby,now %s", windows_exedir(), option);
|
||||
} else {
|
||||
snwprintf(cmd, sizeof(cmd), L"\"%lssmartctl.exe\" -s standby,now %s", windows_exedir(), file);
|
||||
snwprintf(cmd, sizeof(cmd) / sizeof(cmd[0]), L"\"%lssmartctl.exe\" -s standby,now %s", windows_exedir(), file);
|
||||
}
|
||||
|
||||
count = 0;
|
||||
|
|
@ -1364,7 +1364,7 @@ retry:
|
|||
*/
|
||||
if (ret == 2) {
|
||||
/* retry using the "sat" type */
|
||||
snwprintf(cmd, sizeof(cmd), L"\"%lssmartctl.exe\" -s standby,now -d sat %s", windows_exedir(), file);
|
||||
snwprintf(cmd, sizeof(cmd) / sizeof(cmd[0]), L"\"%lssmartctl.exe\" -s standby,now -d sat %s", windows_exedir(), file);
|
||||
|
||||
++count;
|
||||
goto retry;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue