[Git][hardenedbsd/HardenedBSD][hardened/current/cross-dso-cfi] 6 commits: fsck_msdosfs: avoid warnings about too-long initializer strings

0 views
Skip to first unread message

HardenedBSD Services (@hardenedbsd-services)

unread,
Dec 25, 2025, 8:01:52 PM (3 days ago) Dec 25
to src-com...@hardenedbsd.org


HardenedBSD Services pushed to branch hardened/current/cross-dso-cfi at HardenedBSD / HardenedBSD


Commits:
98c3d868 by Dimitry Andric at 2025-12-25T21:34:00+01:00
fsck_msdosfs: avoid warnings about too-long initializer strings

Mark `dot_name` and `dotdot_name` as as `__non_string`, to avoid
warnings from clang 21 similar to:

sbin/fsck_msdosfs/dir.c:466:39: error: initializer-string for character array is too long, array size is 11 but initializer has size 12 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization]
466 | static const u_char dot_name[11] = ". ";
| ^~~~~~~~~~~~~
sbin/fsck_msdosfs/dir.c:467:39: error: initializer-string for character array is too long, array size is 11 but initializer has size 12 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization]
467 | static const u_char dotdot_name[11] = ".. ";
| ^~~~~~~~~~~~~

MFC after: 3 days

- - - - -
ecb58f93 by Igor Ostapenko at 2025-12-25T20:41:22+00:00
kyua: Fix prompt of "debug -p" command

- - - - -
ba0a1151 by Dimitry Andric at 2025-12-26T01:22:18+01:00
makefs: avoid warnings about too-long initializer strings

Mark `direntry::deName` as `__non_string`, to avoid warnings from clang
21 similar to:

usr.sbin/makefs/msdos/msdosfs_vnops.c:512:4: error: initializer-string for character array is too long, array size is 11 but initializer has size 12 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization]
512 | { ". ", /* the . entry */
| ^~~~~~~~~~~~~
usr.sbin/makefs/msdos/msdosfs_vnops.c:522:4: error: initializer-string for character array is too long, array size is 11 but initializer has size 12 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization]
522 | { ".. ", /* the .. entry */
| ^~~~~~~~~~~~~

MFC after: 3 days

- - - - -
a3394b6a by Dimitry Andric at 2025-12-26T01:30:36+01:00
m4: avoid warnings about too-long initializer strings

Mark `digits` as `__non_string`, to avoid warnings from clang 21 similar
to:

usr.bin/m4/misc.c:123:27: error: initializer-string for character array is too long, array size is 36 but initializer has size 37 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization]
123 | static char digits[36] = "0123456789abcdefghijklmnopqrstuvwxyz";
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MFC after: 3 days

- - - - -
38b803e3 by HardenedBSD Sync Services at 2025-12-25T18:01:30-07:00
Merge branch 'freebsd/current/main' into hardened/current/master

- - - - -
8e4ad6f0 by HardenedBSD Sync Services at 2025-12-25T18:01:44-07:00
Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi

- - - - -


4 changed files:

- contrib/kyua/cli/cmd_debug.cpp
- sbin/fsck_msdosfs/dir.c
- usr.bin/m4/misc.c
- usr.sbin/makefs/msdos/direntry.h


Changes:

=====================================
contrib/kyua/cli/cmd_debug.cpp
=====================================
@@ -91,14 +91,14 @@ class dbg : public engine::debugger {
_ui->out("The test failed and paused right before its cleanup "
"routine.");
_ui->out(F("Test work dir: %s") % eh.work_directory().str());
- _ui->out("Press any key to continue...");
+ _ui->out("Press <Enter> to continue...");
(void) std::cin.get();
}
} else if (_cmdline.has_option(pause_before_cleanup_option
.long_name())) {
_ui->out("The test paused right before its cleanup routine.");
_ui->out(F("Test work dir: %s") % eh.work_directory().str());
- _ui->out("Press any key to continue...");
+ _ui->out("Press <Enter> to continue...");
(void) std::cin.get();
}
};


=====================================
sbin/fsck_msdosfs/dir.c
=====================================
@@ -463,8 +463,8 @@ checksize(struct fat_descriptor *fat, u_char *p, struct dosDirEntry *dir)
return FSOK;
}

-static const u_char dot_name[11] = ". ";
-static const u_char dotdot_name[11] = ".. ";
+static const u_char dot_name[11] __nonstring = ". ";
+static const u_char dotdot_name[11] __nonstring = ".. ";

/*
* Basic sanity check if the subdirectory have good '.' and '..' entries,


=====================================
usr.bin/m4/misc.c
=====================================
@@ -120,7 +120,8 @@ pbnum(int n)
void
pbnumbase(int n, int base, int d)
{
- static char digits[36] = "0123456789abcdefghijklmnopqrstuvwxyz";
+ static char digits[36] __nonstring =
+ "0123456789abcdefghijklmnopqrstuvwxyz";
unsigned int num;
int printed = 0;



=====================================
usr.sbin/makefs/msdos/direntry.h
=====================================
@@ -55,7 +55,7 @@
* Structure of a dos directory entry.
*/
struct direntry {
- uint8_t deName[11]; /* filename, blank filled */
+ uint8_t deName[11] __nonstring; /* filename, blank filled */
#define SLOT_EMPTY 0x00 /* slot has never been used */
#define SLOT_E5 0x05 /* the real value is 0xe5 */
#define SLOT_DELETED 0xe5 /* file in this slot deleted */



View it on GitLab: https://git.hardenedbsd.org/hardenedbsd/HardenedBSD/-/compare/9629944dcd23dfc8731ad687bb92e4678dfc0a6b...8e4ad6f0b8441245e2bafded48430f54eaecf213

--
View it on GitLab: https://git.hardenedbsd.org/hardenedbsd/HardenedBSD/-/compare/9629944dcd23dfc8731ad687bb92e4678dfc0a6b...8e4ad6f0b8441245e2bafded48430f54eaecf213
You're receiving this email because of your account on git.hardenedbsd.org.


Reply all
Reply to author
Forward
0 new messages