From: Arran Cudbard-Bell Date: Thu, 3 Aug 2023 21:30:53 +0000 (-0600) Subject: initialise with zero length strings X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7379785d52fee40ad46e7e61b6283b4ab6fc110d;p=thirdparty%2Ffreeradius-server.git initialise with zero length strings --- diff --git a/src/bin/unit_test_attribute.c b/src/bin/unit_test_attribute.c index 662a295a649..1c482912512 100644 --- a/src/bin/unit_test_attribute.c +++ b/src/bin/unit_test_attribute.c @@ -3363,7 +3363,7 @@ static int process_file(bool *exit_now, TALLOC_CTX *ctx, command_config_t const char buffer[8192]; /* Command buffer */ char data[COMMAND_OUTPUT_MAX + 1]; /* Data written by previous command */ ssize_t data_used = 0; /* How much data the last command wrote */ - static char path[PATH_MAX] = { '\0' }; + static char path[PATH_MAX] = ""; command_line_range_t *lr = NULL; command_file_ctx_t *cc; diff --git a/src/lib/util/base_16_32_64_tests.c b/src/lib/util/base_16_32_64_tests.c index cd68b5a770f..6d072a16ae5 100644 --- a/src/lib/util/base_16_32_64_tests.c +++ b/src/lib/util/base_16_32_64_tests.c @@ -81,7 +81,7 @@ static void test_base16_encode(void) static void test_base16_decode(void) { - char buffer[7] = { '\0' }; + char buffer[7] = ""; fr_dbuff_t out; size_t i; @@ -126,7 +126,7 @@ static void test_base32_encode(void) static void test_base32_decode(void) { - char buffer[7] = { '\0' }; + char buffer[7] = ""; fr_dbuff_t out; size_t i; @@ -173,7 +173,7 @@ static void test_base32_hex_encode(void) static void test_base32_hex_decode(void) { - char buffer[7] = { '\0' }; + char buffer[7] = ""; fr_dbuff_t out; size_t i; @@ -220,7 +220,7 @@ static void test_base64_encode(void) static void test_base64_decode(void) { - char buffer[7] = { '\0' }; + char buffer[7] = ""; fr_dbuff_t out; size_t i; diff --git a/src/lib/util/sbuff_tests.c b/src/lib/util/sbuff_tests.c index bb4f2452195..40cd2181756 100644 --- a/src/lib/util/sbuff_tests.c +++ b/src/lib/util/sbuff_tests.c @@ -105,7 +105,7 @@ static void test_bstrncpy_exact(void) { char const in[] = "i am a test string"; char const in_long[] = "i am a longer test string"; - char out[18 + 1] = " "; + char out[18 + 1] = ""; fr_sbuff_t sbuff; ssize_t slen; @@ -227,7 +227,7 @@ static void test_bstrncpy_allowed(void) { char const in[] = "i am a test string"; char const in_long[] = "i am a longer test string"; - char out[18 + 1] = " "; + char out[18 + 1] = ""; fr_sbuff_t sbuff; ssize_t slen; @@ -409,7 +409,7 @@ static void test_unescape_until(void) char const in_long[] = "i am a longer test string"; char const in_escapes[] = "i am a |t|est strin|g"; char const in_escapes_seq[] = "i |x|0am a |t|est strin|g|x20|040"; - char out[18 + 1] = " "; + char out[18 + 1] = ""; char escape_out[20 + 1]; fr_sbuff_t sbuff; @@ -826,7 +826,7 @@ static void test_terminal_merge(void) static void test_no_advance(void) { char const *in = "i am a test string"; - char out[18 + 1] = " "; + char out[18 + 1] = ""; fr_sbuff_t sbuff; ssize_t slen; diff --git a/src/modules/rlm_mschap/opendir.c b/src/modules/rlm_mschap/opendir.c index c0faca271ab..a6bf0853335 100644 --- a/src/modules/rlm_mschap/opendir.c +++ b/src/modules/rlm_mschap/opendir.c @@ -367,7 +367,7 @@ unlang_action_t od_mschap_auth(rlm_rcode_t *p_result, request_t *request, fr_pai memcpy(&len, pStepBuff->fBufferData, sizeof(len)); if (len == 40) { - char mschap_reply[42] = { '\0' }; + char mschap_reply[42] = ""; mschap_reply[0] = 'S'; mschap_reply[1] = '='; memcpy(&(mschap_reply[2]), &(pStepBuff->fBufferData[4]), len);