diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-07-03 00:13:37 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-07-03 00:13:37 +0800 |
commit | ff4ffacb7724c2b150b99ca9728c0ea6cb11442e (patch) | |
tree | 932690da44f4e9c334b6deaba0fbe524a5aaaaf9 /mbbsd | |
parent | c437e6d23ce2e082d1faacaa36e1b4150dce3a21 (diff) | |
download | pttbbs-ff4ffacb7724c2b150b99ca9728c0ea6cb11442e.tar pttbbs-ff4ffacb7724c2b150b99ca9728c0ea6cb11442e.tar.gz pttbbs-ff4ffacb7724c2b150b99ca9728c0ea6cb11442e.tar.bz2 pttbbs-ff4ffacb7724c2b150b99ca9728c0ea6cb11442e.tar.lz pttbbs-ff4ffacb7724c2b150b99ca9728c0ea6cb11442e.tar.xz pttbbs-ff4ffacb7724c2b150b99ca9728c0ea6cb11442e.tar.zst pttbbs-ff4ffacb7724c2b150b99ca9728c0ea6cb11442e.zip |
fix buffer overflow, search use last value
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@404 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/read.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/mbbsd/read.c b/mbbsd/read.c index 8fbbf9a9..fe8c871d 100644 --- a/mbbsd/read.c +++ b/mbbsd/read.c @@ -1,4 +1,4 @@ -/* $Id: read.c,v 1.6 2002/07/02 15:08:52 in2 Exp $ */ +/* $Id: read.c,v 1.7 2002/07/02 16:13:37 in2 Exp $ */ #include "bbs.h" #define MAXPATHLEN 256 @@ -461,7 +461,7 @@ static int select_read(keeploc_t *locmem, int sr_mode) { fileheader_t fh; char fpath[80], genbuf[MAXPATHLEN], buf3[5]; char static t_ans[TTLEN+1]=""; - char static a_ans[IDLEN+1]=""; + char static a_ans[TTLEN+1]=""; int fd, fr, size = sizeof(fileheader_t); struct stat st; /* rocker.011018: make a reference number for process article */ @@ -479,11 +479,14 @@ static int select_read(keeploc_t *locmem, int sr_mode) { else { char buff[80]; + char newdata[35]; query = (sr_mode == RS_RELATED) ? t_ans : a_ans; sprintf(buff, "·j´M%s [%s] ", (sr_mode == RS_RELATED) ? "¼ÐÃD" : "§@ªÌ", query); - getdata(b_lines, 0,buff, query, 30, DOECHO); + getdata(b_lines, 0, buff, newdata, sizeof(newdata), DOECHO); + if( newdata[0] ) + strcpy(query, newdata); if(!(*query)) return DONOTHING; } |