diff options
author | Karel Zak <kzak@redhat.com> | 2006-12-07 00:25:49 +0100 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2006-12-07 00:25:49 +0100 |
commit | e8f2641919de90b488ce3788a7795b88311750b5 (patch) | |
tree | 68f3732da38ff1b21ec49780d7c830250329fec9 /misc-utils/namei.c | |
parent | 364cda4857f7dd5e2b4e2eb7583a2eaa279ef4ed (diff) | |
download | util-linux-old-e8f2641919de90b488ce3788a7795b88311750b5.tar.gz |
Imported from util-linux-2.11m tarball.
Diffstat (limited to 'misc-utils/namei.c')
-rw-r--r-- | misc-utils/namei.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/misc-utils/namei.c b/misc-utils/namei.c index 783c5b9b..60ec98a9 100644 --- a/misc-utils/namei.c +++ b/misc-utils/namei.c @@ -98,7 +98,9 @@ main(int argc, char **argv) { } if(getcwd(curdir, sizeof(curdir)) == NULL){ - (void)fprintf(stderr, _("namei: unable to get current directory - %s\n"), curdir); + (void)fprintf(stderr, + _("namei: unable to get current directory - %s\n"), + curdir); exit(1); } @@ -109,7 +111,9 @@ main(int argc, char **argv) { namei(argv[optind], 0); if(chdir(curdir) == -1){ - (void)fprintf(stderr, _("namei: unable to chdir to %s - %s (%d)\n"), curdir, ERR); + (void)fprintf(stderr, + _("namei: unable to chdir to %s - %s (%d)\n"), + curdir, ERR); exit(1); } } @@ -163,6 +167,11 @@ namei(char *file, int lev) { for(;;){ + if (strlen(file) >= BUFSIZ) { + fprintf(stderr,_("namei: buf overflow\n")); + return; + } + /* * Copy up to the next / (or nil) into buf */ @@ -228,7 +237,7 @@ namei(char *file, int lev) { case S_IFLNK: /* - * Sigh, another symlink. Read it's contents and + * Sigh, another symlink. Read its contents and * call namei() */ |