diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-06-28 16:47:45 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-06-28 16:47:45 +0800 |
commit | 2dea9dc6eeee3dcd9a0ebc32dcee9723c4787c91 (patch) | |
tree | 87e9a623c3a4426e104f87511e2b66f86f75a829 /mbbsd/record.c | |
parent | c5f8b96c358e673945943d92c4ba562eba1f96ec (diff) | |
download | pttbbs-2dea9dc6eeee3dcd9a0ebc32dcee9723c4787c91.tar pttbbs-2dea9dc6eeee3dcd9a0ebc32dcee9723c4787c91.tar.gz pttbbs-2dea9dc6eeee3dcd9a0ebc32dcee9723c4787c91.tar.bz2 pttbbs-2dea9dc6eeee3dcd9a0ebc32dcee9723c4787c91.tar.lz pttbbs-2dea9dc6eeee3dcd9a0ebc32dcee9723c4787c91.tar.xz pttbbs-2dea9dc6eeee3dcd9a0ebc32dcee9723c4787c91.tar.zst pttbbs-2dea9dc6eeee3dcd9a0ebc32dcee9723c4787c91.zip |
assert() the return value of strchr() strrchr()
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@982 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/record.c')
-rw-r--r-- | mbbsd/record.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/mbbsd/record.c b/mbbsd/record.c index 61f58dbc..2bd06b16 100644 --- a/mbbsd/record.c +++ b/mbbsd/record.c @@ -1,4 +1,4 @@ -/* $Id: record.c,v 1.13 2003/02/27 10:48:41 victor Exp $ */ +/* $Id: record.c,v 1.14 2003/06/28 08:47:45 kcwu Exp $ */ #include "bbs.h" #undef HAVE_MMAP @@ -42,7 +42,9 @@ get_sum_records(char *fpath, int size) return -1; strlcpy(buf, fpath, sizeof(buf)); - p = strrchr(buf, '/') + 1; + p = strrchr(buf, '/'); + assert(p); + p++; while (fread(&fhdr, size, 1, fp) == 1) { strcpy(p, fhdr.filename); @@ -275,7 +277,9 @@ delete_range(char *fpath, int id1, int id2) } count = 1; strlcpy(fullpath, fpath, sizeof(fullpath)); - t = strrchr(fullpath, '/') + 1; + t = strrchr(fullpath, '/'); + assert(t); + t++; while (read(fdr, &fhdr, sizeof(fileheader_t)) == sizeof(fileheader_t)) { strcpy(t, fhdr.filename); |