Attention is currently required from: pespin.

fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-mgw/+/35322?usp=email )

Change subject: mgcp: reserve once byte for '\0' in mgcp_do_read()
......................................................................


Patch Set 1:

(1 comment)

File src/libosmo-mgcp-client/mgcp_client.c:

https://gerrit.osmocom.org/c/osmo-mgw/+/35322/comment/4c625f74_e0fabcf7
PS1, Line 762:  ret = read(fd->fd, msg->data, msgb_tailroom(msg) - 1);
> I'd say the proper way would be to use msgb_failroom(msg) here, and then 
> msg->l2h[OSMO_MIN(ret, msgb […]
JFYI, the nul-termination is already done deeper in the code:

```
mgcp_do_read() // this func
  mgcp_client_rx()
    mgcp_response_parse_head()
      mgcp_msg_terminate_nul()
```

I am simply making sure that there will be enough room for this function to 
terminate the received string, if needed. What you suggest is also an option, 
indeed, except that `msg->l2h[OSMO_MIN(ret, msgb_l2len(msg))]` does not make 
sense to me because the code is doing `msg->l2h = msgb_put(msg, ret)` below, so 
that `ret == msgb_l2len(msg)`. Let's see what the others think.



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

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: Icc878af7f671213bb516af62cb601914d86ff808
Gerrit-Change-Number: 35322
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanits...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: pespin <pes...@sysmocom.de>
Gerrit-Attention: pespin <pes...@sysmocom.de>
Gerrit-Comment-Date: Mon, 11 Dec 2023 14:49:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pes...@sysmocom.de>
Gerrit-MessageType: comment

Reply via email to