Skip to content

Commit d019539

Browse files
crrodriguezbluca
authored andcommitted
basic|boot: silence Wunterminated-string-initialization gcc15 warnings
gcc15 has -Wunterminated-string-initialization in -Wextra and warns about string constants that are not null terminated even though the functions do do out of bounds access. Silence the warnings by simply not providing an explicit size. (cherry picked from commit af1a6db) (cherry picked from commit ca09bc3) (cherry picked from commit f6f0d85) (cherry picked from commit e49ce1b) (cherry picked from commit a264598)
1 parent 4bc72f7 commit d019539

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/basic/hexdecoct.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ int undecchar(char c) {
3636
}
3737

3838
char hexchar(int x) {
39-
static const char table[16] = "0123456789abcdef";
39+
static const char table[] = "0123456789abcdef";
4040

4141
return table[x & 15];
4242
}
@@ -171,8 +171,8 @@ int unhexmem_full(const char *p, size_t l, bool secure, void **ret, size_t *ret_
171171
* useful when representing NSEC3 hashes, as one can then verify the
172172
* order of hashes directly from their representation. */
173173
char base32hexchar(int x) {
174-
static const char table[32] = "0123456789"
175-
"ABCDEFGHIJKLMNOPQRSTUV";
174+
static const char table[] = "0123456789"
175+
"ABCDEFGHIJKLMNOPQRSTUV";
176176

177177
return table[x & 31];
178178
}
@@ -522,19 +522,19 @@ int unbase32hexmem(const char *p, size_t l, bool padding, void **mem, size_t *_l
522522

523523
/* https://tools.ietf.org/html/rfc4648#section-4 */
524524
char base64char(int x) {
525-
static const char table[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
526-
"abcdefghijklmnopqrstuvwxyz"
527-
"0123456789+/";
525+
static const char table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
526+
"abcdefghijklmnopqrstuvwxyz"
527+
"0123456789+/";
528528
return table[x & 63];
529529
}
530530

531531
/* This is almost base64char(), but not entirely, as it uses the "url and filename safe" alphabet,
532532
* since we don't want "/" appear in interface names (since interfaces appear in sysfs as filenames).
533533
* See section #5 of RFC 4648. */
534534
char urlsafe_base64char(int x) {
535-
static const char table[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
536-
"abcdefghijklmnopqrstuvwxyz"
537-
"0123456789-_";
535+
static const char table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
536+
"abcdefghijklmnopqrstuvwxyz"
537+
"0123456789-_";
538538
return table[x & 63];
539539
}
540540

0 commit comments

Comments
 (0)