1
0
mirror of https://github.com/Yubico/yubico-pam.git synced 2024-11-29 00:24:11 +01:00

pam_yubico.c: Check for return codes of snprintf()

This commit is contained in:
Karol Babioch 2018-05-17 16:31:36 +02:00
parent f77893a11c
commit 80e7484aea

View File

@ -308,7 +308,11 @@ authorize_user_token_ldap (struct cfg *cfg,
DBG ("Failed allocating %zu bytes", i);
goto done;
}
snprintf (find, i, "%s=%s,%s", cfg->user_attr, user, cfg->ldapdn);
int j = snprintf (find, i, "%s=%s,%s", cfg->user_attr, user, cfg->ldapdn);
if (j < 0 || j >= i) {
DBG ("Failed to format string");
goto done;
}
filter = NULL;
} else if (cfg->ldapdn) {
find = strdup(cfg->ldapdn); /* allow free later */