summaryrefslogtreecommitdiffstats
path: root/misc-utils/namei.c
diff options
context:
space:
mode:
authorKarel Zak2006-12-07 00:25:49 +0100
committerKarel Zak2006-12-07 00:25:49 +0100
commite8f2641919de90b488ce3788a7795b88311750b5 (patch)
tree68f3732da38ff1b21ec49780d7c830250329fec9 /misc-utils/namei.c
parentImported from util-linux-2.11f tarball. (diff)
downloadkernel-qcow2-util-linux-e8f2641919de90b488ce3788a7795b88311750b5.tar.gz
kernel-qcow2-util-linux-e8f2641919de90b488ce3788a7795b88311750b5.tar.xz
kernel-qcow2-util-linux-e8f2641919de90b488ce3788a7795b88311750b5.zip
Imported from util-linux-2.11m tarball.
Diffstat (limited to 'misc-utils/namei.c')
-rw-r--r--misc-utils/namei.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/misc-utils/namei.c b/misc-utils/namei.c
index 783c5b9b6..60ec98a93 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()
*/