summaryrefslogtreecommitdiffstats
path: root/mbbsd/fav.c
diff options
context:
space:
mode:
Diffstat (limited to 'mbbsd/fav.c')
-rw-r--r--mbbsd/fav.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/mbbsd/fav.c b/mbbsd/fav.c
index e7875a72..84951c14 100644
--- a/mbbsd/fav.c
+++ b/mbbsd/fav.c
@@ -1114,7 +1114,7 @@ int updatenewfav(int mode)
brd = (char *)malloc((brdnum + 1) * sizeof(char));
memset(brd, 0, (brdnum + 1) * sizeof(char));
- i = read(fd, brd, (brdnum + 1) * sizeof(char));
+ i = read(fd, brd, brdnum * sizeof(char));
if (i < 0) {
free(brd);
close(fd);
@@ -1122,10 +1122,9 @@ int updatenewfav(int mode)
return -1;
}
- /* if it's a new file, no BRD_END is in it. */
brd[i] = BRD_END;
- for(i = 0; i < brdnum + 1 && brd[i] != BRD_END; i++){
+ for(i = 0; i < brdnum && brd[i] != BRD_END; i++){
if(brd[i] == BRD_NEW){
/* check the permission if the board exsits */
if(bcache[i].brdname[0] && HasBoardPerm(&bcache[i])){