]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
wg: encoding: add missing static array constraints
authorJason A. Donenfeld <Jason@zx2c4.com>
Tue, 5 Jun 2018 22:05:47 +0000 (00:05 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Tue, 5 Jun 2018 22:05:58 +0000 (00:05 +0200)
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
contrib/embeddable-wg-library/wireguard.c
contrib/keygen-html/src/curve25519_generate.c
src/encoding.c

index 560d7ab1e32630f683b1ced4a1dda8ba33f27d9a..c052355544b058d2aa78c9330993fc8675691893 100644 (file)
@@ -1514,7 +1514,7 @@ void wg_free_device(wg_device *dev)
        free(dev);
 }
 
-static void encode_base64(char dest[4], const uint8_t src[3])
+static void encode_base64(char dest[static 4], const uint8_t src[static 3])
 {
        const uint8_t input[] = { (src[0] >> 2) & 63, ((src[0] << 4) | (src[1] >> 4)) & 63, ((src[1] << 2) | (src[2] >> 6)) & 63, src[2] & 63 };
        unsigned int i;
@@ -1539,7 +1539,7 @@ void wg_key_to_base64(wg_key_b64_string base64, const wg_key key)
        base64[sizeof(wg_key_b64_string) - 1] = '\0';
 }
 
-static int decode_base64(const char src[4])
+static int decode_base64(const char src[static 4])
 {
        int val = 0;
        unsigned int i;
index fc4757589ffb3d4c259dc553e3943bf623bfc0b0..3b560a51da8a0b9f07a6c2c227b6effda15bd8ee 100644 (file)
@@ -72,7 +72,7 @@ EMSCRIPTEN_KEEPALIVE void curve25519_generate_private(u8 private[static 32])
        normalize_secret(private);
 }
 
-static inline void encode_base64(char dest[4], const u8 src[3])
+static inline void encode_base64(char dest[static 4], const u8 src[static 3])
 {
        const u8 input[] = { (src[0] >> 2) & 63, ((src[0] << 4) | (src[1] >> 4)) & 63, ((src[1] << 2) | (src[2] >> 6)) & 63, src[2] & 63 };
 
index a9ed69454be364d4cdd52b8525d20fceb29502d6..2e2d915758505c8a9a25400705d67db53f22a822 100644 (file)
@@ -8,7 +8,7 @@
 #include <string.h>
 #include "encoding.h"
 
-static inline void encode_base64(char dest[4], const uint8_t src[3])
+static inline void encode_base64(char dest[static 4], const uint8_t src[static 3])
 {
        const uint8_t input[] = { (src[0] >> 2) & 63, ((src[0] << 4) | (src[1] >> 4)) & 63, ((src[1] << 2) | (src[2] >> 6)) & 63, src[2] & 63 };
 
@@ -32,7 +32,7 @@ void key_to_base64(char base64[static WG_KEY_LEN_BASE64], const uint8_t key[stat
        base64[WG_KEY_LEN_BASE64 - 1] = '\0';
 }
 
-static inline int decode_base64(const char src[4])
+static inline int decode_base64(const char src[static 4])
 {
        int val = 0;