Use MAX_UID_T_LEN + 1 for uid/gid buffers, not MAX_UID_T_LEN to

prevent potential truncation.  Bug #562.
This commit is contained in:
Todd C. Miller
2012-06-27 13:41:58 -04:00
parent 386ba7b062
commit e9f5a38398
2 changed files with 2 additions and 2 deletions

View File

@@ -687,7 +687,7 @@ void
rebuild_env(void) rebuild_env(void)
{ {
char **old_envp, **ep, *cp, *ps1; char **old_envp, **ep, *cp, *ps1;
char idbuf[MAX_UID_T_LEN]; char idbuf[MAX_UID_T_LEN + 1];
unsigned int didvar; unsigned int didvar;
bool reset_home = false; bool reset_home = false;

View File

@@ -1108,7 +1108,7 @@ static char *
sudo_ldap_build_pass1(struct passwd *pw) sudo_ldap_build_pass1(struct passwd *pw)
{ {
struct group *grp; struct group *grp;
char *buf, timebuffer[TIMEFILTER_LENGTH], gidbuf[MAX_UID_T_LEN]; char *buf, timebuffer[TIMEFILTER_LENGTH], gidbuf[MAX_UID_T_LEN + 1];
struct group_list *grlist; struct group_list *grlist;
size_t sz = 0; size_t sz = 0;
int i; int i;