Attention is currently required from: fixeria.
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35313?usp=email )
Change subject: utils: improve readability of OSMO_STRBUF_CHAR_COUNT
......................................................................
Patch Set 1: Code-Review+2
(2 comments)
File include/osmocom/core/utils.h:
https://gerrit.osmocom.org/c/libosmocore/+/35313/comment/3e6f242f_b3fe0217
PS1, Line 300: /*! Get number of actual characters (without terminating nul) in the given struct osmo_strbuf.
(same as prev patch, maybe just normal function in utils.c?)
https://gerrit.osmocom.org/c/libosmocore/+/35313/comment/fa36f20d_f7c14516
PS1, Line 302:
(my wording was a bit brief, reading it now i want to squeeze a "stored" in there somewhere)
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35313?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I71f24b87c13fd83952029171a6993f8da5e32e5b
Gerrit-Change-Number: 35313
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 11 Dec 2023 14:26:57 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: fixeria.
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35312?usp=email )
Change subject: utils: fix OSMO_STRBUF_REMAIN to handle sb.pos == NULL correctly
......................................................................
Patch Set 1:
(1 comment)
File include/osmocom/core/utils.h:
https://gerrit.osmocom.org/c/libosmocore/+/35312/comment/67e5187e_5630e69c
PS1, Line 284: /*! Get remaining space for characters and terminating nul in the given struct osmo_strbuf.
i'm not sure about the inlining, I think i'd just submit a normal function in utils.c.
surely it has some drawbacks somewhere to gather more and more static inline functions (re-compiling the same code bits over and over for every .c context that includes it?)
with macros it's slightly different, they are compiled only when actually in use, otherwise the preproc makes them disappear completely
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35312?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I294a74a99c40995cf7fb5520d61f697d967be5a4
Gerrit-Change-Number: 35312
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 11 Dec 2023 14:24:33 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/35321?usp=email )
Change subject: mgcp: simplify getting msgb tail in mgcp_msg_terminate_nul()
......................................................................
mgcp: simplify getting msgb tail in mgcp_msg_terminate_nul()
The current statement:
msg->l2h + msgb_l2len(msg)
looks as follows, if we expand the msgb_l2len():
msg->l2h + msgb->tail - msg->l2h
so this is basically equal to msgb->tail alone.
Change-Id: I4f4b0f792bbeef94a5449c4a5843628a703a3d54
Related: CID#272990
---
M include/osmocom/mgcp/mgcp_common.h
1 file changed, 21 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/21/35321/1
diff --git a/include/osmocom/mgcp/mgcp_common.h b/include/osmocom/mgcp/mgcp_common.h
index 7de45f9..be5a0d6 100644
--- a/include/osmocom/mgcp/mgcp_common.h
+++ b/include/osmocom/mgcp/mgcp_common.h
@@ -68,7 +68,7 @@
/* Ensure that the msg->l2h is NUL terminated. */
static inline int mgcp_msg_terminate_nul(struct msgb *msg)
{
- unsigned char *tail = msg->l2h + msgb_l2len(msg); /* char after l2 data */
+ unsigned char *tail = msg->tail; /* char after l2 data */
if (tail[-1] == '\0')
/* nothing to do */;
else if (msgb_tailroom(msg) > 0)
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/35321?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: I4f4b0f792bbeef94a5449c4a5843628a703a3d54
Gerrit-Change-Number: 35321
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/35322?usp=email )
Change subject: mgcp: reserve once byte for '\0' in mgcp_do_read()
......................................................................
mgcp: reserve once byte for '\0' in mgcp_do_read()
We need to be able to terminate the received string in case it was
not nul-terminated by the sender (see mgcp_msg_terminate_nul()).
Change-Id: Icc878af7f671213bb516af62cb601914d86ff808
Fixes: CID#272990
---
M src/libosmo-mgcp-client/mgcp_client.c
1 file changed, 15 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/22/35322/1
diff --git a/src/libosmo-mgcp-client/mgcp_client.c b/src/libosmo-mgcp-client/mgcp_client.c
index 8693b1b..cd73391 100644
--- a/src/libosmo-mgcp-client/mgcp_client.c
+++ b/src/libosmo-mgcp-client/mgcp_client.c
@@ -758,7 +758,8 @@
return -1;
}
- ret = read(fd->fd, msg->data, 4096 - 128);
+ /* msgb_tailroom() is basically (4096 - 128); -1 is for '\0' */
+ ret = read(fd->fd, msg->data, msgb_tailroom(msg) - 1);
if (ret <= 0) {
LOGPMGW(mgcp, LOGL_ERROR, "Failed to read: %s: %d='%s'\n",
osmo_sock_get_name2(fd->fd), errno, strerror(errno));
--
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 <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange