From 81905f18dc0594e372cf38cfb0e0b71b69849a43 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Wed, 1 May 2013 01:00:38 -0400 Subject: snapshot of project "lynx", label v2-8-8dev-15b --- src/LYShowInfo.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/LYShowInfo.c') 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 #include #include @@ -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); -- cgit 1.4.1-2-gfad0