From 1d1c09830f1a27b584ea1ac411285d41d12f21d9 Mon Sep 17 00:00:00 2001 From: piaip Date: Fri, 10 Jul 2009 02:55:05 +0000 Subject: * ann: prevent invalid user input causing assert fail of (z_indexes[0] == -1). git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4734 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/announce.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'mbbsd') diff --git a/mbbsd/announce.c b/mbbsd/announce.c index 952f615d..733cd74a 100644 --- a/mbbsd/announce.c +++ b/mbbsd/announce.c @@ -1163,6 +1163,12 @@ int a_parse_zindexes(const char *s, a_menu_session_t *sess) i+1 < _DIM(sess->z_indexes) ) { sess->z_indexes[i] = atoi(s); + // for overflow, ignore all remaining. + if (sess->z_indexes[i] < 0) + { + sess->z_indexes[i] = 0; + break; + } // only increase index if (sess->z_indexes[i]) i++; -- cgit v1.2.3