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:
@@ -201,7 +201,7 @@ sudo_ldap_conf_add_ports(void)
|
||||
|
||||
hostbuf[0] = '\0';
|
||||
len = snprintf(defport, sizeof(defport), ":%d", ldap_conf.port);
|
||||
if (len <= 0 || len >= (int)sizeof(defport)) {
|
||||
if (len < 0 || len >= ssizeof(defport)) {
|
||||
sudo_warnx(U_("sudo_ldap_conf_add_ports: port too large"));
|
||||
debug_return_bool(false);
|
||||
}
|
||||
|
Reference in New Issue
Block a user