diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-09-21 13:41:18 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-09-21 13:41:18 +0800 |
commit | fb0f9fb4276c7183f04046d82d124fe0eabfd460 (patch) | |
tree | 4c3fbbd26ba3de9860977d7b209755f29933951f | |
parent | 5c2feefbb3efe2c5313babaf2f09f89294c7a6a9 (diff) | |
download | pttbbs-fb0f9fb4276c7183f04046d82d124fe0eabfd460.tar pttbbs-fb0f9fb4276c7183f04046d82d124fe0eabfd460.tar.gz pttbbs-fb0f9fb4276c7183f04046d82d124fe0eabfd460.tar.bz2 pttbbs-fb0f9fb4276c7183f04046d82d124fe0eabfd460.tar.lz pttbbs-fb0f9fb4276c7183f04046d82d124fe0eabfd460.tar.xz pttbbs-fb0f9fb4276c7183f04046d82d124fe0eabfd460.tar.zst pttbbs-fb0f9fb4276c7183f04046d82d124fe0eabfd460.zip |
reduce mywrite segv (hope so)
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3198 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | mbbsd/talk.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/mbbsd/talk.c b/mbbsd/talk.c index 56f1d4bd..503eac7a 100644 --- a/mbbsd/talk.c +++ b/mbbsd/talk.c @@ -674,6 +674,10 @@ my_write(pid_t pid, const char *prompt, const char *id, int flag, userinfo_t * p uin = (puin != NULL) ? puin : (userinfo_t *) search_ulist_pid(pid); strlcpy(destid, id, sizeof(destid)); + /* what if uin is NULL but other conditions are not true? + * will this situation cause SEGV? + * should this "!uin &&" replaced by "!uin ||" ? + */ if (!uin && !((flag == WATERBALL_GENERAL #ifdef PLAY_ANGEL || flag == WATERBALL_ANGEL || flag == WATERBALL_ANSWER @@ -706,10 +710,14 @@ my_write(pid_t pid, const char *prompt, const char *id, int flag, userinfo_t * p move(1, 0); clrtoeol(); outs(ANSI_COLOR(1;31) "你的呼叫器目前不接受別人丟水球,對方可能無法回話。" ANSI_RESET); break; + case PAGER_FRIENDONLY: - fri_stat = friend_stat(currutmp, uin); - if(fri_stat & HFM) - break; + if (uin) + { + fri_stat = friend_stat(currutmp, uin); + if(fri_stat & HFM) + break; + } move(1, 0); clrtoeol(); outs(ANSI_COLOR(1;31) "你的呼叫器目前只接受好友丟水球,對方可能無法回話。" ANSI_RESET); break; |