]> granicus.if.org Git - esp-idf/commitdiff
wpa_supplicant: fix errors for GCC 8 support
authorAnton Maklakov <anton@espressif.com>
Tue, 29 May 2018 07:36:43 +0000 (15:36 +0800)
committerbot <bot@espressif.com>
Mon, 2 Jul 2018 09:05:00 +0000 (09:05 +0000)
components/wpa_supplicant/port/include/os.h:259:29: error: 'strncpy' output truncated before terminating nul copying 3 bytes from a string of the same length [-Werror=stringop-truncation]
 #define os_strncpy(d, s, n) strncpy((d), (s), (n))
                             ^~~~~~~~~~~~~~~~~~~~~~
components/wpa_supplicant/src/wpa2/eap_peer/eap.c:410:3: note: in expansion of macro 'os_strncpy'
   os_strncpy(sm->blob[0].name, CLIENT_CERT_NAME, BLOB_NAME_LEN);
   ^~~~~~~~~~

components/wpa_supplicant/src/wpa2/eap_peer/eap.c

index 865da65470f27a7a0a3636854a703f41070ff1e3..10fc2257bd6f9b95d3c8e2625088653669cbfca4 100644 (file)
@@ -407,7 +407,7 @@ int eap_peer_blob_init(struct eap_sm *sm)
                        ret = -2;
                        goto _out;
                }
-               os_strncpy(sm->blob[0].name, CLIENT_CERT_NAME, BLOB_NAME_LEN);
+               os_strncpy(sm->blob[0].name, CLIENT_CERT_NAME, BLOB_NAME_LEN+1);
                sm->blob[0].len = g_wpa_client_cert_len;
                sm->blob[0].data = g_wpa_client_cert;
        }
@@ -418,7 +418,7 @@ int eap_peer_blob_init(struct eap_sm *sm)
                        ret = -2;
                        goto _out;
                }
-               os_strncpy(sm->blob[1].name, PRIVATE_KEY_NAME, BLOB_NAME_LEN);
+               os_strncpy(sm->blob[1].name, PRIVATE_KEY_NAME, BLOB_NAME_LEN+1);
                sm->blob[1].len = g_wpa_private_key_len;
                sm->blob[1].data = g_wpa_private_key;
        }
@@ -429,7 +429,7 @@ int eap_peer_blob_init(struct eap_sm *sm)
                        ret = -2;
                        goto _out;
                }
-               os_strncpy(sm->blob[2].name, CA_CERT_NAME, BLOB_NAME_LEN);
+               os_strncpy(sm->blob[2].name, CA_CERT_NAME, BLOB_NAME_LEN+1);
                sm->blob[2].len = g_wpa_ca_cert_len;
                sm->blob[2].data = g_wpa_ca_cert;
        }