Steve Dickson wrote on 2020/11/08 5:26:
Hello,
I'm getting a build failure on the armv7hl arch
and the i686 arch, which do not make much sense.
The build is [1] and only those arche are complaining about an sprintf()
statement.
The rest of the arches are fine with the statment... %99.9 of the arches
that are used today... I didn't even realize i686 was still supported!
The is the failure:
conffile.c: In function 'conf_init_dir':
conffile.c:707:22: error: '%s' directive writing between 6 and 2147483645 bytes
into a region of size between 4095 and 4096 [-Werror=format-overflow=]
707 | sprintf(fname, "%s/%s", dname, d->d_name);
| ^~
In file included from /usr/include/stdio.h:866,
from conffile.c:45:
/usr/include/bits/stdio2.h:38:10: note: '__sprintf_chk' output 8 or more bytes
(assuming 2147483648) into a destination of size 4097
38 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
39 | __bos (__s), __fmt, __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
So I change the sprintf() to an snprintf() [2] guaranteeing no
overflow and I got the same failure. So it is something esoteric
about those arches... that I'm missing...
Anybody have clue as to what is going on??
tia,
steved.
[1] https://koji.fedoraproject.org/koji/taskinfo?taskID=55125502
[2] https://koji.fedoraproject.org/koji/taskinfo?taskID=55126237
Not a direct answer, but it seems checking the return value of snprintf() makes
-Werror=format-overflow or -Werror=format-truncation happy:
https://koji.fedoraproject.org/koji/taskinfo?taskID=55157631
How I've changed is to modify your
"0001-conffile-process-config.d-directory-config-files.patch" as:
========================================================================
--- 0001-conffile-process-config.d-directory-config-files.patch.old
2020-11-07 00:32:04.000000000 +0900
+++ 0001-conffile-process-config.d-directory-config-files.patch 2020-11-08
18:40:02.634207926 +0900
@@ -106,7 +106,7 @@
+ continue;
+
+ fname_len = strlen(d->d_name);
-+ if (!fname_len || (fname_len + dname_len) > PATH_MAX) {
++ if (!fname_len || (snprintf(fname, PATH_MAX + 1, "%s/%s", dname,
d->d_name) > PATH_MAX)) {
+ xlog(L_WARNING, "conf_init_dir: Too long file name: %s in
%s",
+ d->d_name, dname);
+ continue;
@@ -128,7 +128,7 @@
+ continue;
+ }
+
-+ sprintf(fname, "%s/%s", dname, d->d_name);
++ /*sprintf(fname, "%s/%s", dname, d->d_name);*/
+
+ if (conf_load_files(trans, fname))
+ continue;
========================================================================
Regards,
Mamoru
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org