Add ssizeof macro that returns ssize_t.
We can use this instead of casting the result of size_t to int. Also change checks for snprintf() returning <=0 to <0.
This commit is contained in:
@@ -74,7 +74,7 @@ group_plugin_load(char *plugin_info)
|
||||
len = snprintf(path, sizeof(path), "%s%s",
|
||||
(*plugin_info != '/') ? path_plugin_dir : "", plugin_info);
|
||||
}
|
||||
if (len <= 0 || len >= (int)sizeof(path)) {
|
||||
if (len < 0 || len >= ssizeof(path)) {
|
||||
errno = ENAMETOOLONG;
|
||||
sudo_warn("%s%s",
|
||||
(*plugin_info != '/') ? path_plugin_dir : "", plugin_info);
|
||||
|
Reference in New Issue
Block a user