summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-04-29 15:05:45 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-04-29 15:05:45 +0800
commit00c4a848e63ee19ca7f36ba6e7ba0102cc086c09 (patch)
tree8c69ebd77b845199df8573a7a7dd153e42d01fee
parentda81316536e0af773dc46e9779d384fcb23e890b (diff)
downloadpttbbs-00c4a848e63ee19ca7f36ba6e7ba0102cc086c09.tar
pttbbs-00c4a848e63ee19ca7f36ba6e7ba0102cc086c09.tar.gz
pttbbs-00c4a848e63ee19ca7f36ba6e7ba0102cc086c09.tar.bz2
pttbbs-00c4a848e63ee19ca7f36ba6e7ba0102cc086c09.tar.lz
pttbbs-00c4a848e63ee19ca7f36ba6e7ba0102cc086c09.tar.xz
pttbbs-00c4a848e63ee19ca7f36ba6e7ba0102cc086c09.tar.zst
pttbbs-00c4a848e63ee19ca7f36ba6e7ba0102cc086c09.zip
fix buffer overflow
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@133 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/announce.c4
-rw-r--r--mbbsd/bbs.c8
-rw-r--r--mbbsd/mail.c8
-rw-r--r--mbbsd/read.c10
-rw-r--r--mbbsd/var.c6
5 files changed, 18 insertions, 18 deletions
diff --git a/mbbsd/announce.c b/mbbsd/announce.c
index 5920e45e..2064ba9d 100644
--- a/mbbsd/announce.c
+++ b/mbbsd/announce.c
@@ -1,4 +1,4 @@
-/* $Id: announce.c,v 1.5 2002/04/28 19:35:28 in2 Exp $ */
+/* $Id: announce.c,v 1.6 2002/04/29 07:05:45 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -1248,7 +1248,7 @@ static void atitle() {
}
#endif
-extern char currtitle[];
+extern char currtitle[TTLEN + 1];
char trans_buffer[256];
extern char quote_file[];
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 28322370..eb252233 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -1,4 +1,4 @@
-/* $Id: bbs.c,v 1.2 2002/04/28 19:35:28 in2 Exp $ */
+/* $Id: bbs.c,v 1.3 2002/04/29 07:05:45 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -154,7 +154,7 @@ static void readtitle() {
extern int brc_num;
extern int brc_list[];
-extern char currtitle[];
+extern char currtitle[TTLEN + 1];
extern int Tagger();
@@ -186,7 +186,7 @@ static void readdoent(int num, fileheader_t *ent) {
if(title[47])
strcpy(title + 44, " ¡K"); /* §â¦h¾lªº string ¬å±¼ */
- if(strncmp(currtitle, title, 40))
+ if(strncmp(currtitle, title, TTLEN))
prints("%6d %c %-7s%-13.12s%s %s\n", num, type,
ent->date, ent->owner, mark, title);
else
@@ -838,7 +838,7 @@ static int read_post(int ent, fileheader_t *fhdr, char *direct) {
return DONOTHING;
brc_addlist(fhdr->filename);
- strncpy(currtitle, subject(fhdr->title), 40);
+ strncpy(currtitle, subject(fhdr->title), TTLEN);
strncpy(currowner, subject(fhdr->owner), IDLEN + 2);
switch (more_result) {
diff --git a/mbbsd/mail.c b/mbbsd/mail.c
index bc6ff7b3..3fa7ae37 100644
--- a/mbbsd/mail.c
+++ b/mbbsd/mail.c
@@ -1,4 +1,4 @@
-/* $Id: mail.c,v 1.3 2002/04/28 19:35:29 in2 Exp $ */
+/* $Id: mail.c,v 1.4 2002/04/29 07:05:45 in2 Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -28,7 +28,7 @@ extern char *fn_notes;
extern char *msg_mailer;
extern char *msg_sure_ny;
extern char *BBSName;
-extern char currtitle[44];
+extern char currtitle[TTLEN + 1];
extern unsigned char currfmode; /* current file mode */
extern char *msg_del_ny;
extern char currfile[FNLEN];
@@ -847,7 +847,7 @@ static void maildoent(int num, fileheader_t *ent) {
mark = "R:";
}
- if(strncmp(currtitle, title, 40))
+ if(strncmp(currtitle, title, TTLEN))
prints("%5d %c %-7s%-15.14s%s %.46s\n", num, type,
ent->date, ent->owner, mark, title);
else
@@ -896,7 +896,7 @@ static int mail_read(int ent, fileheader_t *fhdr, char *direct) {
clear();
setdirpath(buf, direct, fhdr->filename);
- strncpy(currtitle, subject(fhdr->title), 40);
+ strncpy(currtitle, subject(fhdr->title), TTLEN);
done = delete_it = replied = NA;
while(!done) {
int more_result = more(buf, YEA);
diff --git a/mbbsd/read.c b/mbbsd/read.c
index b2cc64a4..5866422e 100644
--- a/mbbsd/read.c
+++ b/mbbsd/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.2 2002/04/28 19:35:29 in2 Exp $ */
+/* $Id: read.c,v 1.3 2002/04/29 07:05:45 in2 Exp $ */
#include <stdio.h>
#include <string.h>
#include <ctype.h>
@@ -19,7 +19,7 @@
extern int p_lines; /* a Page of Screen line numbers: tlines-4 */
extern int b_lines; /* Screen bottom line number: t_lines-1 */
extern char currowner[IDLEN + 2];
-extern char currtitle[44];
+extern char currtitle[TTLEN + 1];
extern char currauthor[IDLEN + 2];
extern char *str_reply;
extern char *msg_fwd_ok;
@@ -385,7 +385,7 @@ static int thread(keeploc_t *locmem, int stype) {
tag = headers[pos - locmem->top_ln].title;
if(stype & RS_CURRENT) {
if(stype & RS_FIRST) {
- if(!strncmp(currtitle, tag, 40))
+ if(!strncmp(currtitle, tag, TTLEN))
return DONOTHING;
near = 0;
}
@@ -468,8 +468,8 @@ static int thread(keeploc_t *locmem, int stype) {
match = cursor_pos(locmem, now, 10);
if((!(stype & RS_CURRENT)) &&
(stype & RS_RELATED) &&
- strncmp(currtitle, query, 40)) {
- strncpy(currtitle, query, 40);
+ strncmp(currtitle, query, TTLEN)) {
+ strncpy(currtitle, query, TTLEN);
match = PARTUPDATE;
}
break;
diff --git a/mbbsd/var.c b/mbbsd/var.c
index 7b07f63b..6f531c21 100644
--- a/mbbsd/var.c
+++ b/mbbsd/var.c
@@ -1,4 +1,4 @@
-/* $Id: var.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: var.c,v 1.2 2002/04/29 07:05:45 in2 Exp $ */
#include <stdio.h>
#include <sys/types.h>
#include "config.h"
@@ -91,8 +91,8 @@ time_t paste_time;
char paste_title[STRLEN];
char paste_path[256];
int paste_level;
-char currtitle[40] = "\0";
-char vetitle[40] = "\0";
+char currtitle[TTLEN + 1] = "\0";
+char vetitle[TTLEN + 1] = "\0";
char currowner[IDLEN + 2] = "\0";
char currauthor[IDLEN + 2] = "\0";
char currfile[FNLEN]; /* current file name @ bbs.c mail.c */