From 3e95f5f57f0988c3a48a4d9f40f38b7d7ca05d1b Mon Sep 17 00:00:00 2001 From: ptt Date: Fri, 7 Jun 2002 19:10:10 +0000 Subject: *** empty log message *** git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@312 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/gamble.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/gamble.c b/mbbsd/gamble.c index 065b05b4..69127e1e 100644 --- a/mbbsd/gamble.c +++ b/mbbsd/gamble.c @@ -1,4 +1,4 @@ -/* $Id: gamble.c,v 1.12 2002/06/07 19:03:25 ptt Exp $ */ +/* $Id: gamble.c,v 1.13 2002/06/07 19:10:10 ptt Exp $ */ #include "bbs.h" #ifndef _BBS_UTIL_C_ @@ -49,8 +49,9 @@ int post_file(char* bname, char* title, char *filename, char* author) if(size<=0) return -1; if(!(fp=fopen(filename,"r")) ) return -1; - msg= (char *)malloc(size); - fread(msg,1,size,fp); + msg= (char *)malloc(size+1); + size = fread(msg,1,size,fp); + msg[size]=0; size= post_msg(bname, title, msg, author); fclose(fp); free(msg); -- cgit v1.2.3