From: Richard Mudgett Date: Tue, 29 May 2012 22:28:55 +0000 (+0000) Subject: Coverity Report: Fix issues for error type REVERSE_INULL (deprecated modules) X-Git-Tag: 10.6.0-rc1~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a1876e87515faa19cd6c39bb328e36bd9a1a2a8;p=thirdparty%2Fasterisk.git Coverity Report: Fix issues for error type REVERSE_INULL (deprecated modules) * Fix only issue pointed out by deprecated_REVERSE_INULL.txt for app_meetme.c in find_user(). * Change use of %i to %d in sscanf() in find_user(). The use of %i gives unexpected parsing because it can accept hex, octal, and decimal integer formats. * Changed other uses of %i in app_meetme() to use %d for consistency. (issue ASTERISK-19648) Reported by: Matt Jordan ........ Merged revisions 367906 from http://svn.asterisk.org/svn/asterisk/branches/1.8 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@367907 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_meetme.c b/apps/app_meetme.c index e6e465e05e..588c3d6851 100644 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -2173,12 +2173,12 @@ static int can_write(struct ast_channel *chan, struct ast_flags64 *confflags) static void send_talking_event(struct ast_channel *chan, struct ast_conference *conf, struct ast_conf_user *user, int talking) { ast_manager_event(chan, EVENT_FLAG_CALL, "MeetmeTalking", - "Channel: %s\r\n" - "Uniqueid: %s\r\n" - "Meetme: %s\r\n" - "Usernum: %d\r\n" - "Status: %s\r\n", - chan->name, chan->uniqueid, conf->confno, user->user_no, talking ? "on" : "off"); + "Channel: %s\r\n" + "Uniqueid: %s\r\n" + "Meetme: %s\r\n" + "Usernum: %d\r\n" + "Status: %s\r\n", + chan->name, chan->uniqueid, conf->confno, user->user_no, talking ? "on" : "off"); } static void set_user_talking(struct ast_channel *chan, struct ast_conference *conf, struct ast_conf_user *user, int talking, int monitor) @@ -3127,12 +3127,12 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc } ast_manager_event(chan, EVENT_FLAG_CALL, "MeetmeMute", - "Channel: %s\r\n" - "Uniqueid: %s\r\n" - "Meetme: %s\r\n" - "Usernum: %i\r\n" - "Status: on\r\n", - chan->name, chan->uniqueid, conf->confno, user->user_no); + "Channel: %s\r\n" + "Uniqueid: %s\r\n" + "Meetme: %s\r\n" + "Usernum: %d\r\n" + "Status: on\r\n", + chan->name, chan->uniqueid, conf->confno, user->user_no); } /* If I should be un-muted but am not talker, un-mute me */ @@ -3145,12 +3145,12 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc } ast_manager_event(chan, EVENT_FLAG_CALL, "MeetmeMute", - "Channel: %s\r\n" - "Uniqueid: %s\r\n" - "Meetme: %s\r\n" - "Usernum: %i\r\n" - "Status: off\r\n", - chan->name, chan->uniqueid, conf->confno, user->user_no); + "Channel: %s\r\n" + "Uniqueid: %s\r\n" + "Meetme: %s\r\n" + "Usernum: %d\r\n" + "Status: off\r\n", + chan->name, chan->uniqueid, conf->confno, user->user_no); } if ((user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) && @@ -3158,12 +3158,12 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc talkreq_manager = 1; ast_manager_event(chan, EVENT_FLAG_CALL, "MeetmeTalkRequest", - "Channel: %s\r\n" - "Uniqueid: %s\r\n" - "Meetme: %s\r\n" - "Usernum: %i\r\n" - "Status: on\r\n", - chan->name, chan->uniqueid, conf->confno, user->user_no); + "Channel: %s\r\n" + "Uniqueid: %s\r\n" + "Meetme: %s\r\n" + "Usernum: %d\r\n" + "Status: on\r\n", + chan->name, chan->uniqueid, conf->confno, user->user_no); } @@ -3171,12 +3171,12 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc !(user->adminflags & ADMINFLAG_T_REQUEST) && (talkreq_manager)) { talkreq_manager = 0; ast_manager_event(chan, EVENT_FLAG_CALL, "MeetmeTalkRequest", - "Channel: %s\r\n" - "Uniqueid: %s\r\n" - "Meetme: %s\r\n" - "Usernum: %i\r\n" - "Status: off\r\n", - chan->name, chan->uniqueid, conf->confno, user->user_no); + "Channel: %s\r\n" + "Uniqueid: %s\r\n" + "Meetme: %s\r\n" + "Usernum: %d\r\n" + "Status: off\r\n", + chan->name, chan->uniqueid, conf->confno, user->user_no); } /* If I have been kicked, exit the conference */ @@ -4550,9 +4550,8 @@ static struct ast_conf_user *find_user(struct ast_conference *conf, const char * { struct ast_conf_user *user = NULL; int cid; - - sscanf(callerident, "%30i", &cid); - if (conf && callerident) { + + if (conf && callerident && sscanf(callerident, "%30d", &cid) == 1) { user = ao2_find(conf->usercontainer, &cid, 0); /* reference decremented later in admin_exec */ return user;