diff options
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/opie/opieinfo.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/contrib/opie/opieinfo.c b/contrib/opie/opieinfo.c index a5d0d57..614dad6 100644 --- a/contrib/opie/opieinfo.c +++ b/contrib/opie/opieinfo.c @@ -35,14 +35,17 @@ $FreeBSD$ */ #include "opie_cfg.h" +#include <sys/param.h> +#include <errno.h> #include <stdio.h> +#include <string.h> #if HAVE_UNISTD_H #include <unistd.h> #endif /* HAVE_UNISTD_H */ #include "opie.h" /* extern char *optarg; */ -extern int errno, optind; +/* extern int errno, optind; */ static char *getusername FUNCTION_NOARGS { @@ -82,6 +85,11 @@ int main FUNCTION((argc, argv), int argc AND char *argv[]) } else username = getusername(); + if (strlen(username) >= MAXLOGNAME) { + fprintf(stderr, "Username too long.\n"); + exit(1); + } + if ((i = opielookup(&opie, username)) && (i != 2)) { if (i < 0) fprintf(stderr, "Error opening database! (errno = %d)\n", errno); |