Skip to content

Commit a264598

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)
1 parent f2c2b65 commit a264598

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
}
@@ -168,8 +168,8 @@ int unhexmem_full(
168168
* useful when representing NSEC3 hashes, as one can then verify the
169169
* order of hashes directly from their representation. */
170170
char base32hexchar(int x) {
171-
static const char table[32] = "0123456789"
172-
"ABCDEFGHIJKLMNOPQRSTUV";
171+
static const char table[] = "0123456789"
172+
"ABCDEFGHIJKLMNOPQRSTUV";
173173

174174
return table[x & 31];
175175
}
@@ -519,19 +519,19 @@ int unbase32hexmem(const char *p, size_t l, bool padding, void **mem, size_t *_l
519519

520520
/* https://tools.ietf.org/html/rfc4648#section-4 */
521521
char base64char(int x) {
522-
static const char table[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
523-
"abcdefghijklmnopqrstuvwxyz"
524-
"0123456789+/";
522+
static const char table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
523+
"abcdefghijklmnopqrstuvwxyz"
524+
"0123456789+/";
525525
return table[x & 63];
526526
}
527527

528528
/* This is almost base64char(), but not entirely, as it uses the "url and filename safe" alphabet,
529529
* since we don't want "/" appear in interface names (since interfaces appear in sysfs as filenames).
530530
* See section #5 of RFC 4648. */
531531
char urlsafe_base64char(int x) {
532-
static const char table[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
533-
"abcdefghijklmnopqrstuvwxyz"
534-
"0123456789-_";
532+
static const char table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
533+
"abcdefghijklmnopqrstuvwxyz"
534+
"0123456789-_";
535535
return table[x & 63];
536536
}
537537

0 commit comments

Comments
 (0)