various files - fix some alerts raised by lgtm code analysis

This patch fixes several issues reported by the lgtm code analysis tool:

https://lgtm.com/projects/g/asterisk/asterisk

Not all reported issues were addressed in this patch. This patch mostly fixes
confirmed reported errors, potential problematic code points, and a few other
"low hanging" warnings or recommendations found in core supported modules.
These include, but are not limited to the following:

* innapropriate stack allocation in loops
* buffer overflows
* variable declaration "hiding" another variable declaration
* comparisons results that are always the same
* ambiguously signed bit-field members
* missing header guards

Change-Id: Id4a881686605d26c94ab5409bc70fcc21efacc25
This commit is contained in:
Kevin Harwell
2019-10-23 12:36:17 -05:00
committed by George Joseph
parent 990a91b44a
commit bdd785d31c
49 changed files with 324 additions and 203 deletions

View File

@@ -2086,15 +2086,16 @@ static int jingle_interpret_description(struct jingle_session *session, iks *des
/* Iterate the codecs updating the relevant RTP instance as we go */
for (codec = iks_child(description); codec; codec = iks_next(codec)) {
char *id = iks_find_attrib(codec, "id"), *name = iks_find_attrib(codec, "name");
char *id = iks_find_attrib(codec, "id");
char *attr_name = iks_find_attrib(codec, "name");
char *clockrate = iks_find_attrib(codec, "clockrate");
int rtp_id, rtp_clockrate;
if (!ast_strlen_zero(id) && !ast_strlen_zero(name) && (sscanf(id, "%30d", &rtp_id) == 1)) {
if (!ast_strlen_zero(id) && !ast_strlen_zero(attr_name) && (sscanf(id, "%30d", &rtp_id) == 1)) {
if (!ast_strlen_zero(clockrate) && (sscanf(clockrate, "%30d", &rtp_clockrate) == 1)) {
ast_rtp_codecs_payloads_set_rtpmap_type_rate(&codecs, NULL, rtp_id, media, name, 0, rtp_clockrate);
ast_rtp_codecs_payloads_set_rtpmap_type_rate(&codecs, NULL, rtp_id, media, attr_name, 0, rtp_clockrate);
} else {
ast_rtp_codecs_payloads_set_rtpmap_type(&codecs, NULL, rtp_id, media, name, 0);
ast_rtp_codecs_payloads_set_rtpmap_type(&codecs, NULL, rtp_id, media, attr_name, 0);
}
}
}