diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9df0be13..aedb1266 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/igrr/astyle_py.git - rev: v1.0.5 + rev: v1.1.0 hooks: - id: astyle_py files: '^.*\.(c|cpp|cxx|h|h.in|h.riot|h.riot.in|h.windows|h.windows.in|h.contiki|hpp|inc)$' @@ -24,7 +24,7 @@ repos: '--unpad-paren'] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v6.0.0 hooks: - id: trailing-whitespace exclude: 'tests/oss-fuzz/.*_seed_corpus/.*$' @@ -32,7 +32,7 @@ repos: exclude: 'tests/oss-fuzz/.*_seed_corpus/.*$' - id: check-merge-conflict - repo: https://github.com/codespell-project/codespell - rev: v2.4.1 + rev: v2.4.3 hooks: - id: codespell exclude: 'tests/oss-fuzz/.*_seed_corpus/.*$|examples/etsi_iot_01_largedata.txt|AUTHORS|examples/riot/Makefile' diff --git a/examples/lwip/Makefile b/examples/lwip/Makefile index 9539efdd..2c977aae 100644 --- a/examples/lwip/Makefile +++ b/examples/lwip/Makefile @@ -25,7 +25,7 @@ USE_LWIP_CONTRIB := $(shell if [ $(WITH_LWIP_BRANCH) = "STABLE-2_1_3_RELEASE" ] fi) # Update to latest TinyDTLS submodule as defined for libcoap -WITH_TINYDTLS_BRANCH=c6a209f689a225655534249e79103558aa8656e6 +WITH_TINYDTLS_BRANCH=f009bc82283e847905490d84e3f3cfc7ee6cc447 # Need to determine which library clock_gettime() resides in (as found by ./autogen.sh) LDLIBS := $(shell if [ -f $(libcoap_dir)/config.log ] ; then \ diff --git a/ext/tinydtls b/ext/tinydtls index c6a209f6..f009bc82 160000 --- a/ext/tinydtls +++ b/ext/tinydtls @@ -1 +1 @@ -Subproject commit c6a209f689a225655534249e79103558aa8656e6 +Subproject commit f009bc82283e847905490d84e3f3cfc7ee6cc447 diff --git a/man/examples-code-check.c b/man/examples-code-check.c index ff590005..332575fa 100644 --- a/man/examples-code-check.c +++ b/man/examples-code-check.c @@ -365,15 +365,16 @@ decode_synopsis_definition(FILE *fpheader, const char *buffer, int in_synopsis) (outbuf[len-3] == '*' && outbuf[len-2] == ';'))) { if (!is_inline_func && !is_void_func && !is_number_func && !is_struct_func && !is_struct && !is_ptr) { - char *lcp = strchr(buffer, ' '); + const char *lcp = strchr(buffer, ' '); if (lcp) - *lcp = '\000'; - fprintf(stderr, - "man/examples-code-check.c: Function return type '%s' undefined in pointer_list[] or number_list[]\n", - &buffer[1]); - if (lcp) - *lcp = ' '; + fprintf(stderr, + "man/examples-code-check.c: Function return type '%*.*s' undefined in pointer_list[] or number_list[]\n", + (int)(lcp - buffer), (int)(lcp - buffer), &buffer[1]); + else + fprintf(stderr, + "man/examples-code-check.c: Function return type '%s' undefined in pointer_list[] or number_list[]\n", + &buffer[1]); exit_code = 1; } if (is_inline_func) { @@ -401,43 +402,47 @@ decode_synopsis_definition(FILE *fpheader, const char *buffer, int in_synopsis) } cleanup: if (in_synopsis && func_start) { - char *wcp = strchr(func_start, '('); + const char *wcp = strchr(func_start, '('); + char tmpbuf[99]; if (!wcp && is_struct) wcp = strchr(func_start, ';'); if (!wcp) { wcp = strchr(func_start, '\n'); if (wcp) - *wcp = '\000'; - fprintf(stderr, "SYNOPSIS: function %s issue\n", func_start); + fprintf(stderr, "SYNOPSIS: function %*.*s issue\n", (int)(wcp - func_start), + (int)(wcp - func_start), func_start); + else + fprintf(stderr, "SYNOPSIS: function %s issue\n", func_start); return; } - *wcp = '\000'; + snprintf(tmpbuf, sizeof(tmpbuf), "%*.*s", (int)(wcp - func_start), (int)(wcp - func_start), + func_start); for (i = 0; i < name_cnt; i++) { - if (strcmp(name_list[i], func_start) == 0) { + if (strcmp(name_list[i], tmpbuf) == 0) { name_list[i][0] = '\000'; break; } } if (i == name_cnt) { - fprintf(stderr, "SYNOPSIS: %s not in NAME\n", func_start); + fprintf(stderr, "SYNOPSIS: %s not in NAME\n", tmpbuf); exit_code = 1; } if (!is_void_func && !is_struct) { for (i = 0; i < return_cnt; i++) { - if (strcmp(func_start, return_list[i]) == 0) { - fprintf(stderr, "SYNOPSIS: %s duplicated\n", func_start); + if (strcmp(tmpbuf, return_list[i]) == 0) { + fprintf(stderr, "SYNOPSIS: %s duplicated\n", tmpbuf); break; } } if (i != return_cnt) return; if (i >= (int)(sizeof(return_list)/sizeof(return_list[0]))) { - fprintf(stderr, "SYNOPSIS: %s insufficient space (%u >= %u)\n", func_start, + fprintf(stderr, "SYNOPSIS: %s insufficient space (%u >= %u)\n", tmpbuf, i, (int)(sizeof(return_list)/sizeof(return_list[0]))); return; } - strncpy(return_list[i], func_start, sizeof(return_list[i])-1); + strncpy(return_list[i], tmpbuf, sizeof(return_list[i])-1); return_cnt++; } } diff --git a/src/coap_resource.c b/src/coap_resource.c index 56899345..b5d6e806 100644 --- a/src/coap_resource.c +++ b/src/coap_resource.c @@ -79,7 +79,7 @@ match(const coap_str_const_t *text, const coap_str_const_t *pattern, while (remaining_length) { size_t token_length; const uint8_t *token = next_token; - next_token = (unsigned char *)memchr(token, ' ', remaining_length); + next_token = (const unsigned char *)memchr(token, ' ', remaining_length); if (next_token) { token_length = next_token - token; diff --git a/src/coap_tinydtls.c b/src/coap_tinydtls.c index b51ecc57..2ea43603 100644 --- a/src/coap_tinydtls.c +++ b/src/coap_tinydtls.c @@ -1331,8 +1331,8 @@ ec_abstract_pkcs8_asn1(const uint8_t *asn1_ptr, size_t asn1_length) { static coap_binary_t * pem_decode_mem_asn1(const char *begstr, const uint8_t *str) { - char *bcp = str ? strstr((const char *)str, begstr) : NULL; - char *tcp = bcp ? strstr(bcp, "-----END ") : NULL; + const char *bcp = str ? strstr((const char *)str, begstr) : NULL; + const char *tcp = bcp ? strstr(bcp, "-----END ") : NULL; if (bcp && tcp) { bcp += strlen(begstr);