summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-02 23:22:38 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-06-02 23:22:38 +0800
commit60d87af129d7be6fe6a73362c7144d47aa98fe2c (patch)
tree7c6a5a589a105bec904f51443055d496bef46e8c /mbbsd
parentbdb0fdec9b4cf76b77b34058021326cf7a7d3bb8 (diff)
downloadpttbbs-60d87af129d7be6fe6a73362c7144d47aa98fe2c.tar
pttbbs-60d87af129d7be6fe6a73362c7144d47aa98fe2c.tar.gz
pttbbs-60d87af129d7be6fe6a73362c7144d47aa98fe2c.tar.bz2
pttbbs-60d87af129d7be6fe6a73362c7144d47aa98fe2c.tar.lz
pttbbs-60d87af129d7be6fe6a73362c7144d47aa98fe2c.tar.xz
pttbbs-60d87af129d7be6fe6a73362c7144d47aa98fe2c.tar.zst
pttbbs-60d87af129d7be6fe6a73362c7144d47aa98fe2c.zip
the 'D' command on hot boards (using safe_delete) must check valid range (reported by YTDoctor@ptt)
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4489 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/record.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mbbsd/record.c b/mbbsd/record.c
index 83bafe76..7e6206e8 100644
--- a/mbbsd/record.c
+++ b/mbbsd/record.c
@@ -300,7 +300,9 @@ safe_article_delete_range(const char *direct, int from, int to)
lseek(fd, sizeof(fileheader_t) * (from - 1), SEEK_SET) != -1 ){
for( ; from <= to ; ++from ){
- read(fd, &newfhdr, sizeof(fileheader_t));
+ // the (from, to) range may be invalid...
+ if (read(fd, &newfhdr, sizeof(fileheader_t)) != sizeof(fileheader_t))
+ break;
if( newfhdr.filemode & (FILE_MARKED | FILE_DIGEST) )
continue;
if(newfhdr.filename[0]=='L') newfhdr.filename[0]='M';