<p>pespin has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/24641">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">msgb_alloc_headroom: Validate size arg fits a uint16_t<br><br>Underlaying APIs (msgb_alloc) use a uint16_t as a type, which means<br>until now passing a value > 2^16 would succeed providing a msgb with<br>less space than requested.<br><br>Since those are static inline, there's no symbols used by apps, so we<br>should be safe enough changing the type to be uint16_t, since change<br>would only be applied at re-compile time.<br><br>Change-Id: I83c8222484e4856c68134a1a9d8cf96eb91af1b8<br>---<br>M include/osmocom/core/msgb.h<br>1 file changed, 2 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/41/24641/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmocom/core/msgb.h b/include/osmocom/core/msgb.h</span><br><span>index cc76e3a..df796c9 100644</span><br><span>--- a/include/osmocom/core/msgb.h</span><br><span>+++ b/include/osmocom/core/msgb.h</span><br><span>@@ -524,7 +524,7 @@</span><br><span>  * followed by \ref msgb_reserve in order to create a new \ref msgb with</span><br><span>  * user-specified amount of headroom.</span><br><span>  */</span><br><span style="color: hsl(0, 100%, 40%);">-static inline struct msgb *msgb_alloc_headroom_c(const void *ctx, int size, int headroom,</span><br><span style="color: hsl(120, 100%, 40%);">+static inline struct msgb *msgb_alloc_headroom_c(const void *ctx, uint16_t size, uint16_t headroom,</span><br><span>                                                const char *name)</span><br><span> {</span><br><span>      osmo_static_assert(size >= headroom, headroom_bigger);</span><br><span>@@ -546,7 +546,7 @@</span><br><span>  * followed by \ref msgb_reserve in order to create a new \ref msgb with</span><br><span>  * user-specified amount of headroom.</span><br><span>  */</span><br><span style="color: hsl(0, 100%, 40%);">-static inline struct msgb *msgb_alloc_headroom(int size, int headroom,</span><br><span style="color: hsl(120, 100%, 40%);">+static inline struct msgb *msgb_alloc_headroom(uint16_t size, uint16_t headroom,</span><br><span>                                          const char *name)</span><br><span> {</span><br><span>       osmo_static_assert(size >= headroom, headroom_bigger);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/24641">change 24641</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/libosmocore/+/24641"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I83c8222484e4856c68134a1a9d8cf96eb91af1b8 </div>
<div style="display:none"> Gerrit-Change-Number: 24641 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>