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:
Todd C. Miller
2019-06-25 09:45:10 -06:00
parent 81602ad086
commit 9d8f374397
17 changed files with 31 additions and 28 deletions

View File

@@ -492,7 +492,7 @@ sudo_ldap_timefilter(char *buffer, size_t buffersize)
/* Build filter. */
len = snprintf(buffer, buffersize, "(&(|(!(sudoNotAfter=*))(sudoNotAfter>=%s))(|(!(sudoNotBefore=*))(sudoNotBefore<=%s)))",
timebuffer, timebuffer);
if (len <= 0 || (size_t)len >= buffersize) {
if (len < 0 || (size_t)len >= buffersize) {
sudo_warnx(U_("internal error, %s overflow"), __func__);
errno = EOVERFLOW;
len = -1;