<p></p>
<p>Mh, so you are basically "misusing" the <code>_buf</code> API for a different than the intended use case, gotcha!</p>
<blockquote>
<p>The point of this is to allow the stack to fail gracefully (allowing the protocol to continue rather than deadlocking it) when overly long messages arrive, which generally means to ask for smaller bites of data. An application will pick its buffer in accordance with the messages it expects, so if someone wants to haul 1KiB messages, they can up their buffer.</p>
</blockquote>
<p>Mh, but consider this: we only put the header of a packet into the internal buffer and for the rest an application may choose to use:</p>
<div class="highlight highlight-source-c"><pre><span class="pl-c"><span class="pl-c">/*</span> just a sketch! <span class="pl-c">*/</span></span>
<span class="pl-k">while</span> ((res = gcoap_get_payload(pkt, &buf[pos]) > <span class="pl-c1">0</span>) {
    pos += res;
}</pre></div>
<p>this way, a developer does not need to beat themselves over the head of configuring some module they may or may non know about and can do all the necessary compile-time config in the app. No '"get follow-up or "yeah but there's a pointer you can follow up on and need to free" stuff' required, if we establish that <em>this</em> is the way to get a packet's payload.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/RIOT-OS/RIOT/pull/16378#issuecomment-905567004">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABE7WYG5SSLLHCFPQAJHDC3T6T64DANCNFSM43NLKLAQ">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email">Android</a>.<img src="https://github.com/notifications/beacon/ABE7WYA2GL6WK72W3YJO7ZDT6T64DA5CNFSM43NLKLA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGX45WHA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/RIOT-OS/RIOT/pull/16378#issuecomment-905567004",
"url": "https://github.com/RIOT-OS/RIOT/pull/16378#issuecomment-905567004",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>