diff options
author | Anil Madhavapeddy <avsm@cvs.openbsd.org> | 2003-04-22 23:21:51 +0000 |
---|---|---|
committer | Anil Madhavapeddy <avsm@cvs.openbsd.org> | 2003-04-22 23:21:51 +0000 |
commit | e44d7024f11c55dda9eb57072b1256b410065539 (patch) | |
tree | 69da6b03ba757491c1b2dbaf1a6e678f7fa339d0 /gnu/usr.bin | |
parent | 56f96568f9010c5568376245f275cf84643791b7 (diff) |
replace an unbounded fscanf with an fgets
suggested by and ok millert@
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r-- | gnu/usr.bin/lynx/WWW/Library/Implementation/HTNews.c | 7 |
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); |