[Asterisk-code-review] pjsip/cli commands: pjsip show channelstats shows wrong codec (asterisk[13])

Joshua Colp asteriskteam at digium.com
Wed Mar 8 08:03:15 CST 2017


Joshua Colp has posted comments on this change. ( https://gerrit.asterisk.org/5120 )

Change subject: pjsip/cli_commands: pjsip show channelstats shows wrong codec
......................................................................


Patch Set 3: Code-Review-1

(1 comment)

https://gerrit.asterisk.org/#/c/5120/3/channels/pjsip/cli_commands.c
File channels/pjsip/cli_commands.c:

Line 349: 	struct ast_format_cap *format_cap = ast_channel_nativeformats(channel) ? ast_channel_nativeformats(channel) : NULL;
Accessing nativeformats like this is unsafe. Another thread can actually replace (and destroy) the underlying format capabilities while you are using it. This was actually an issue in a few other places in the past.

The channel has to be locked using ast_channel_lock while accessing ast_channel_nativeformats and unlocked afterwards. It'd suggest locking it, checking for nativeformats, printing the names into the codec_buf if present, and then unlocking before outputting the information.


-- 
To view, visit https://gerrit.asterisk.org/5120
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I3889ef6a8f6738fc312fab42db5efacd6e452b01
Gerrit-PatchSet: 3
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Daniel Journo <dan at keshercommunications.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Daniel Journo <dan at keshercommunications.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list