Compare commits

...

1 Commits

Author SHA1 Message Date
David Abdurachmanov c3bd58fa9c
Resolves compilation error:
+ cc -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -Wall -Werror=implicit-function-declaration -Werror -I/usr/include/nspr4 -I/usr/include/nss3 certwatch.c pemutil.c -o certwatch -lnspr4 -lnss3
BUILDSTDERR: In file included from /usr/include/string.h:494,
BUILDSTDERR:                  from /usr/include/nss3/secport.h:45,
BUILDSTDERR:                  from /usr/include/nss3/seccomon.h:27,
BUILDSTDERR:                  from /usr/include/nss3/nss.h:34,
BUILDSTDERR:                  from certwatch.c:77:
BUILDSTDERR: In function 'strncpy',
BUILDSTDERR:     inlined from 'get_common_name' at certwatch.c:249:5,
BUILDSTDERR:     inlined from 'check_cert' at certwatch.c:289:9,
BUILDSTDERR:     inlined from 'main' at certwatch.c:387:12:
BUILDSTDERR: /usr/include/bits/string_fortified.h:106:10: error: '__builtin___strncpy_chk' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
BUILDSTDERR:   106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
BUILDSTDERR:       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BUILDSTDERR: certwatch.c: In function 'main':
BUILDSTDERR: certwatch.c:246:15: note: length computed here
BUILDSTDERR:   246 |     namelen = strlen(name);
BUILDSTDERR:       |               ^~~~~~~~~~~~
BUILDSTDERR: cc1: all warnings being treated as errors

Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
2019-03-21 15:44:34 +01:00
2 changed files with 5 additions and 2 deletions

View File

@ -246,7 +246,7 @@ static int get_common_name(CERTCertificate *cert, char *buf, size_t bufsiz)
namelen = strlen(name);
if (bufsiz < namelen+1) return -1;
strncpy(buf, name, namelen);
memcpy(buf, name, namelen);
buf[namelen] = '\0';
PORT_Free(name);

View File

@ -4,7 +4,7 @@
Summary: SSL certificate and key management utilities
Name: crypto-utils
Version: 2.5
Release: 5%{?dist}
Release: 5.0.riscv64%{?dist}
# certwatch.c is GPLv2
# pemutil.c etc are (MPLv1.1+ or GPLv2+ or LPGLv2+)
# librand is MIT
@ -135,6 +135,9 @@ chmod -R u+w $RPM_BUILD_ROOT
%{perl_vendorarch}/auto/Crypt
%changelog
* Thu Mar 21 2019 David Abdurachmanov <david.abdurachmanov@gmail.com> - 2.5-5.0.riscv64
- Fix GCC 9 compilation error
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.5-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild