Change in osmo-mgw[master]: mgcp_client: do not crash when lco/sdp can not be generated

dexter gerrit-no-reply at lists.osmocom.org
Wed Jun 2 20:02:35 UTC 2021


dexter has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/24182 )

Change subject: mgcp_client: do not crash when lco/sdp can not be generated
......................................................................


Patch Set 2:

(2 comments)

https://gerrit.osmocom.org/c/osmo-mgw/+/24182/1/src/libosmo-mgcp-client/mgcp_client.c 
File src/libosmo-mgcp-client/mgcp_client.c:

https://gerrit.osmocom.org/c/osmo-mgw/+/24182/1/src/libosmo-mgcp-client/mgcp_client.c@1122 
PS1, Line 1122: 				rc += -1;
> Agree with pau, it's not clear why we subtract. […]
The error code handling here is not obvious at the first look. The return codes from msgb_printf() are added up. Since msgb_printf() either return 0 (success) or -EINVAL a sum of 0 means that everything went well. However the check 0 is done at the end and it is reserved for msgb buffer space issues only, so subtracting -1 will appear as a buffer space issue but it is not. The correct way to do this is to free the msg buffer and to return -2. This requires a return code check by the caller of course.

So subtracting -1 wouln't have done any harm other than causing a slightly wrong error diagnosis.


https://gerrit.osmocom.org/c/osmo-mgw/+/24182/1/src/libosmo-mgcp-client/mgcp_client.c@1234 
PS1, Line 1234: 				rc += -1;
> +1
To be conform with the rest it should indeed not do that. It should free the buffer and return -2 (see code above)



-- 
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/24182
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: Ibb788343e0bec9c0eaf33e6e4727d4d36c100017
Gerrit-Change-Number: 24182
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-Comment-Date: Wed, 02 Jun 2021 20:02:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge at osmocom.org>
Comment-In-Reply-To: pespin <pespin at sysmocom.de>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210602/d4a62e77/attachment.htm>


More information about the gerrit-log mailing list