summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-04-10 18:26:08 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-04-10 18:26:08 +0800
commit744278308f5c23b65b081011b37740e316d78109 (patch)
tree1c24b95f9077a4ba4097eac330aec445d8aa42ce
parentd93d125daa5cdd83714b90ea2cf7d8b43a9bbf07 (diff)
downloadpttbbs-744278308f5c23b65b081011b37740e316d78109.tar
pttbbs-744278308f5c23b65b081011b37740e316d78109.tar.gz
pttbbs-744278308f5c23b65b081011b37740e316d78109.tar.bz2
pttbbs-744278308f5c23b65b081011b37740e316d78109.tar.lz
pttbbs-744278308f5c23b65b081011b37740e316d78109.tar.xz
pttbbs-744278308f5c23b65b081011b37740e316d78109.tar.zst
pttbbs-744278308f5c23b65b081011b37740e316d78109.zip
handle bad input to avoid SIGSEGV
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@786 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--util/bbsmail.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/util/bbsmail.c b/util/bbsmail.c
index 0663a5c8..8e326ad7 100644
--- a/util/bbsmail.c
+++ b/util/bbsmail.c
@@ -1,4 +1,4 @@
-/* $Id: bbsmail.c,v 1.6 2002/11/02 11:15:27 in2 Exp $ */
+/* $Id: bbsmail.c,v 1.7 2003/04/10 10:26:08 in2 Exp $ */
#define _UTIL_C_
#include "bbs.h"
@@ -133,7 +133,11 @@ mail2bbs(userid)
if (ip[-1] == ' ')
ip[-1] = '\0';
ptr = (char *) strchr(genbuf, ' ');
- while (*ptr == ' ') ptr++;
+ if( ptr )
+ while (*ptr == ' ')
+ ptr++;
+ else
+ ptr = "unknown";
sprintf(sender, "%s (%s)", ip + 1, ptr);
}
else