Recent compilers have activated some additional checks which let the build fail. (at least with cygwin) (Normally it would be warnings but opensc compiles with -Werror) GCC 9.3: In file included from profile.c:27: profile.c: In function '__expr_get': profile.c:2273:18: error: array subscript has type 'char' [-Werror=char-subscripts] 2273 | while (isspace(*s)) | ^~ clang 8.0.1: compat_getopt_main.c:102:22: error: array subscript is of type 'char' [-Werror,-Wchar-subscripts] rc = toupper(rc); ^~~~~~~~~~~ /usr/include/ctype.h:161:25: note: expanded from macro 'toupper' (void) __CTYPE_PTR[__x]; (toupper) (__x);}) ^~~~ Actually the code is correct as isspace and others are used here with data type char, and are to be used with data type int. So either the compiler should have deactivated this error, or the ctype.h macros have to be written so the compiler no longer complains. As there is also a simple workaround by casting char to unsigned char, there is no need to wait for one of the former options to be happen sometime. |
||
---|---|---|
.. | ||
ChangeLog.compat_getopt | ||
LICENSE.compat_getopt | ||
Makefile.am | ||
Makefile.mak | ||
README.compat_getopt | ||
README.compat_strlcpy | ||
compat___iob_func.c | ||
compat_dummy.c | ||
compat_getopt.3 | ||
compat_getopt.c | ||
compat_getopt.h | ||
compat_getopt.txt | ||
compat_getopt_main.c | ||
compat_getpass.c | ||
compat_getpass.h | ||
compat_report_rangecheckfailure.c | ||
compat_strlcat.c | ||
compat_strlcat.h | ||
compat_strlcpy.3 | ||
compat_strlcpy.c | ||
compat_strlcpy.h | ||
compat_strnlen.c | ||
compat_strnlen.h | ||
libpkcs11.c | ||
libpkcs11.h | ||
libscdl.c | ||
libscdl.h | ||
simclist.c | ||
simclist.h |
README.compat_strlcpy
strncpy() is unsafe since it does not always add a final NUL-byte. OpenBSD developed a safer version called strlcpy(). Use "man -l strlcpy.3" to read the manpage. The files strlcpy.3 and strlcpy.c comes from ftp://ftp.openbsd.org/pub/OpenBSD/src/lib/libc/string/ and are Copyright (c) 1998, 2000 Todd C. Miller <Todd.Miller@courtesan.com>