diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2013-05-01 01:00:38 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2013-05-01 01:00:38 -0400 |
commit | 81905f18dc0594e372cf38cfb0e0b71b69849a43 (patch) | |
tree | 8eb23ef6f907e1a4f53bd7c2247522b077037e63 /src/LYShowInfo.c | |
parent | 7827f0bdba0c75376e59443975f3638df4cce044 (diff) | |
download | lynx-snapshots-81905f18dc0594e372cf38cfb0e0b71b69849a43.tar.gz |
snapshot of project "lynx", label v2-8-8dev-15b
Diffstat (limited to 'src/LYShowInfo.c')
-rw-r--r-- | src/LYShowInfo.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/LYShowInfo.c b/src/LYShowInfo.c index f3b7f8fb..ef20791f 100644 --- a/src/LYShowInfo.c +++ b/src/LYShowInfo.c @@ -1,4 +1,4 @@ -/* $LynxId: LYShowInfo.c,v 1.72 2010/09/25 00:47:28 tom Exp $ */ +/* $LynxId: LYShowInfo.c,v 1.73 2013/01/04 01:20:17 tom Exp $ */ #include <HTUtils.h> #include <HTFile.h> #include <HTParse.h> @@ -209,11 +209,14 @@ int LYShowInfo(DocInfo *doc, if (S_ISLNK(dir_info.st_mode)) { char buf[MAX_LINE]; int buf_size; + size_t limit = sizeof(buf) - 1; - if ((buf_size = (int) readlink(temp, buf, sizeof(buf) - 1)) != -1) { + if ((buf_size = (int) readlink(temp, buf, limit)) != -1) { + if (buf_size > (int) limit) + buf_size = (int) limit; buf[buf_size] = '\0'; } else { - sprintf(buf, "%.*s", (int) sizeof(buf) - 1, + sprintf(buf, "%.*s", (int) limit, gettext("Unable to follow link")); } ADD_SS(gettext("Points to file:"), buf); |