Merge pull request #268 from stoeckmann/chfn
chfn: Prevent buffer overflow.
This commit is contained in:
commit
b215e9d02c
@ -61,7 +61,7 @@ static char fullnm[BUFSIZ];
|
|||||||
static char roomno[BUFSIZ];
|
static char roomno[BUFSIZ];
|
||||||
static char workph[BUFSIZ];
|
static char workph[BUFSIZ];
|
||||||
static char homeph[BUFSIZ];
|
static char homeph[BUFSIZ];
|
||||||
static char slop[BUFSIZ];
|
static char slop[BUFSIZ + 1 + 80];
|
||||||
static bool amroot;
|
static bool amroot;
|
||||||
/* Flags */
|
/* Flags */
|
||||||
static bool fflg = false; /* -f - set full name */
|
static bool fflg = false; /* -f - set full name */
|
||||||
@ -311,6 +311,11 @@ static void process_flags (int argc, char **argv)
|
|||||||
exit (E_NOPERM);
|
exit (E_NOPERM);
|
||||||
}
|
}
|
||||||
oflg = true;
|
oflg = true;
|
||||||
|
if (strlen (optarg) > (unsigned int) 80) {
|
||||||
|
fprintf (stderr,
|
||||||
|
_("%s: fields too long\n"), Prog);
|
||||||
|
exit (E_NOPERM);
|
||||||
|
}
|
||||||
STRFCPY (slop, optarg);
|
STRFCPY (slop, optarg);
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
|
Loading…
Reference in New Issue
Block a user