* libmisc/loginprompt.c: Prefer snprintf to sprintf, even if a

small context indicates no issues.
This commit is contained in:
nekral-guest 2009-04-24 22:27:58 +00:00
parent 37eec13774
commit 42e72c418d
2 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2009-04-25 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/loginprompt.c: Prefer snprintf to sprintf, even if a
small context indicates no issues.
2009-04-25 Nicolas François <nicolas.francois@centraliens.net>
* src/faillog.c: Remove function calls from within assert().

View File

@ -156,8 +156,9 @@ void login_prompt (const char *prompt, char *name, int namesize)
if (strchr (nvar, '=') != NULL) {
envp[envc] = nvar;
} else {
envp[envc] = xmalloc (strlen (nvar) + 32);
sprintf (envp[envc], "L%d=%s", count++, nvar);
size_t len = strlen (nvar) + 32;
envp[envc] = xmalloc (len);
snprintf (envp[envc], len, "L%d=%s", count++, nvar);
}
}
set_env (envc, envp);