]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
initialise with zero length strings
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 3 Aug 2023 21:30:53 +0000 (15:30 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 9 Aug 2023 21:29:44 +0000 (15:29 -0600)
src/bin/unit_test_attribute.c
src/lib/util/base_16_32_64_tests.c
src/lib/util/sbuff_tests.c
src/modules/rlm_mschap/opendir.c

index 662a295a6497cdee5fefeeac5f11be7f4105d7d3..1c4829125121153c9f69b72f03d900544652f84b 100644 (file)
@@ -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;
index cd68b5a770fbdd49ba232f7c547262a3a38c4505..6d072a16ae550b32c2ac377f8d7c2722f7642b45 100644 (file)
@@ -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;
 
index bb4f2452195a49f130084dfec3f5f059bfcbea9e..40cd218175682edc471ed35de9f3497a57471fc1 100644 (file)
@@ -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;
 
index c0faca271abe9870db365d3f67a07d67a942358f..a6bf0853335081b79097944dd35bf09ab4cf2e40 100644 (file)
@@ -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);