0001-coap_oscore-c-Fix-parsing-OSCORE-configuration-information.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. From 2b28d8b0e9607e71a145345b4fe49517e052b7d9 Mon Sep 17 00:00:00 2001
  2. From: Jon Shallow <supjps-libcoap@jpshallow.com>
  3. Date: Thu, 25 Jan 2024 18:03:17 +0000
  4. Subject: [PATCH] coap_oscore.c: Fix parsing OSCORE configuration information
  5. Upstream: https://github.com/obgm/libcoap/commit/2b28d8b0e9607e71a145345b4fe49517e052b7d9
  6. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  7. ---
  8. src/coap_oscore.c | 5 +++--
  9. 1 file changed, 3 insertions(+), 2 deletions(-)
  10. diff --git a/src/coap_oscore.c b/src/coap_oscore.c
  11. index 83f785c92..e0fb22947 100644
  12. --- a/src/coap_oscore.c
  13. +++ b/src/coap_oscore.c
  14. @@ -1678,11 +1678,12 @@ get_split_entry(const char **start,
  15. oscore_value_t *value) {
  16. const char *begin = *start;
  17. const char *end;
  18. + const char *kend;
  19. const char *split;
  20. size_t i;
  21. retry:
  22. - end = memchr(begin, '\n', size);
  23. + kend = end = memchr(begin, '\n', size);
  24. if (end == NULL)
  25. return 0;
  26. @@ -1693,7 +1694,7 @@ get_split_entry(const char **start,
  27. if (begin[0] == '#' || (end - begin) == 0) {
  28. /* Skip comment / blank line */
  29. - size -= end - begin + 1;
  30. + size -= kend - begin + 1;
  31. begin = *start;
  32. goto retry;
  33. }