summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/lynx
diff options
context:
space:
mode:
authorAnil Madhavapeddy <avsm@cvs.openbsd.org>2003-04-22 23:21:51 +0000
committerAnil Madhavapeddy <avsm@cvs.openbsd.org>2003-04-22 23:21:51 +0000
commite44d7024f11c55dda9eb57072b1256b410065539 (patch)
tree69da6b03ba757491c1b2dbaf1a6e678f7fa339d0 /gnu/usr.bin/lynx
parent56f96568f9010c5568376245f275cf84643791b7 (diff)
replace an unbounded fscanf with an fgets
suggested by and ok millert@
Diffstat (limited to 'gnu/usr.bin/lynx')
-rw-r--r--gnu/usr.bin/lynx/WWW/Library/Implementation/HTNews.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gnu/usr.bin/lynx/WWW/Library/Implementation/HTNews.c b/gnu/usr.bin/lynx/WWW/Library/Implementation/HTNews.c
index 5d511904e52..99433f0740b 100644
--- a/gnu/usr.bin/lynx/WWW/Library/Implementation/HTNews.c
+++ b/gnu/usr.bin/lynx/WWW/Library/Implementation/HTNews.c
@@ -214,10 +214,13 @@ PRIVATE BOOL initialize NOARGS
CTRACE(tfp, "HTNews: NNTPSERVER defined as `%s'\n",
HTNewsHost);
} else {
- char server_name[256];
FILE* fp = fopen(SERVER_FILE, "r");
if (fp) {
- if (fscanf(fp, "%s", server_name)==1) {
+ char server_name[MAXHOSTNAMELEN+1];
+ if (fgets(server_name, sizeof server_name, fp) != NULL) {
+ char *p = strchr(server_name, '\n');
+ if (p != NULL)
+ *p = '\0';
StrAllocCopy(HTNewsHost, server_name);
CTRACE(tfp, "HTNews: File %s defines news host as `%s'\n",
SERVER_FILE, HTNewsHost);