[riot-notifications] [RIOT-OS/RIOT] net/gcoap: Use nanocoap pkt/options API (#9156)

Ken Bannister notifications at github.com
Thu Nov 22 09:57:38 CET 2018


kb2ma commented on this pull request.



>      size_t key_len = strlen(key);
     size_t val_len = (val) ? (strlen(val) + 1) : 0;
 
-    /* make sure if url_len + the new query string fit into the url buffer */
-    if ((qs_len + key_len + val_len + 2) >= NANOCOAP_QS_MAX) {
+    /* add 2 for '=' and null terminator */
+    if ((key_len + val_len + 2) >= NANOCOAP_QS_MAX) {

Yes, you're right about `+ 2`. I misinterpreted the reason for the addition in the old code. It was for the '&' and the null terminator, not for the '=' and the null. However, we no longer need to consider the '&' for the local `qs` buffer. So, the test should be changed to `+ 1`.

Thanks for the suggested replacement. I'll review.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/9156#discussion_r235643511
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20181122/6b396567/attachment.html>


More information about the notifications mailing list