mirror of
https://repo.or.cz/socat.git
synced 2025-01-08 22:12:33 +00:00
ctype(3) functions need there arguments to be unsigned char
This commit is contained in:
parent
893d031cc2
commit
5edcb9b308
7 changed files with 11 additions and 8 deletions
3
CHANGES
3
CHANGES
|
@ -37,6 +37,9 @@ Corrections:
|
||||||
or have trailing garbage.
|
or have trailing garbage.
|
||||||
Test: INTEGER_GARBAGE
|
Test: INTEGER_GARBAGE
|
||||||
|
|
||||||
|
ctype(3) functions need there arguments to be unsigned char.
|
||||||
|
Thanks to Taylor R Campbell for sending a patch.
|
||||||
|
|
||||||
Porting:
|
Porting:
|
||||||
OpenSSL, at least 1.1 on Ubuntu, crashed with SIGSEGV under certain
|
OpenSSL, at least 1.1 on Ubuntu, crashed with SIGSEGV under certain
|
||||||
conditions: client connection to server with certificate with empty
|
conditions: client connection to server with certificate with empty
|
||||||
|
|
2
error.c
2
error.c
|
@ -357,7 +357,7 @@ void msg2(
|
||||||
syslp = bufp;
|
syslp = bufp;
|
||||||
*bufp++ = "DINWEF"[level];
|
*bufp++ = "DINWEF"[level];
|
||||||
#if 0 /* only for debugging socat */
|
#if 0 /* only for debugging socat */
|
||||||
if (handler) bufp[-1] = tolower(bufp[-1]); /* for debugging, low chars indicate messages from signal handlers */
|
if (handler) bufp[-1] = tolower((unsigned char)bufp[-1]); /* for debugging, low chars indicate messages from signal handlers */
|
||||||
#endif
|
#endif
|
||||||
*bufp++ = ' ';
|
*bufp++ = ' ';
|
||||||
strncpy(bufp, text, BUFLEN-(bufp-buff)-1);
|
strncpy(bufp, text, BUFLEN-(bufp-buff)-1);
|
||||||
|
|
|
@ -745,7 +745,7 @@ int xiosetenv(const char *varname, const char *value, int overwrite, const char
|
||||||
progname = diag_get_string('p');
|
progname = diag_get_string('p');
|
||||||
envname[0] = '\0'; strncat(envname, progname, XIO_ENVNAMELEN-1);
|
envname[0] = '\0'; strncat(envname, progname, XIO_ENVNAMELEN-1);
|
||||||
l = strlen(envname);
|
l = strlen(envname);
|
||||||
for (i = 0; i < l; ++i) envname[i] = toupper(envname[i]);
|
for (i = 0; i < l; ++i) envname[i] = toupper((unsigned char)envname[i]);
|
||||||
strncat(envname+l, "_", XIO_ENVNAMELEN-l-1);
|
strncat(envname+l, "_", XIO_ENVNAMELEN-l-1);
|
||||||
l += 1;
|
l += 1;
|
||||||
strncat(envname+l, varname, XIO_ENVNAMELEN-l-1);
|
strncat(envname+l, varname, XIO_ENVNAMELEN-l-1);
|
||||||
|
@ -771,7 +771,7 @@ int xiosetenv2(const char *varname, const char *varname2, const char *value,
|
||||||
l += 1;
|
l += 1;
|
||||||
strncat(envname+l, varname2, XIO_ENVNAMELEN-l-1);
|
strncat(envname+l, varname2, XIO_ENVNAMELEN-l-1);
|
||||||
l += strlen(envname+l);
|
l += strlen(envname+l);
|
||||||
for (i = 0; i < l; ++i) envname[i] = toupper(envname[i]);
|
for (i = 0; i < l; ++i) envname[i] = toupper((unsigned char)envname[i]);
|
||||||
return _xiosetenv(envname, value, overwrite, sep);
|
return _xiosetenv(envname, value, overwrite, sep);
|
||||||
# undef XIO_ENVNAMELEN
|
# undef XIO_ENVNAMELEN
|
||||||
}
|
}
|
||||||
|
@ -799,7 +799,7 @@ int xiosetenv3(const char *varname, const char *varname2, const char *varname3,
|
||||||
l += 1;
|
l += 1;
|
||||||
strncat(envname+l, varname3, XIO_ENVNAMELEN-l-1);
|
strncat(envname+l, varname3, XIO_ENVNAMELEN-l-1);
|
||||||
l += strlen(envname+l);
|
l += strlen(envname+l);
|
||||||
for (i = 0; i < l; ++i) envname[i] = toupper(envname[i]);
|
for (i = 0; i < l; ++i) envname[i] = toupper((unsigned char)envname[i]);
|
||||||
return _xiosetenv(envname, value, overwrite, sep);
|
return _xiosetenv(envname, value, overwrite, sep);
|
||||||
# undef XIO_ENVNAMELEN
|
# undef XIO_ENVNAMELEN
|
||||||
}
|
}
|
||||||
|
|
2
utils.c
2
utils.c
|
@ -97,7 +97,7 @@ static size_t sanitize_char(char c, char *o, int style) {
|
||||||
int hn; /* high nibble */
|
int hn; /* high nibble */
|
||||||
int ln; /* low nibble */
|
int ln; /* low nibble */
|
||||||
int n; /* written chars */
|
int n; /* written chars */
|
||||||
if (isprint(c)) {
|
if (isprint((unsigned char)c)) {
|
||||||
*o = c;
|
*o = c;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -404,7 +404,7 @@ int vsnprintf_r(char *str, size_t size, const char *format, va_list ap) {
|
||||||
do {
|
do {
|
||||||
fsize = 10*fsize+(c-'0');
|
fsize = 10*fsize+(c-'0');
|
||||||
c = *format++;
|
c = *format++;
|
||||||
} while (c && isdigit(c));
|
} while (c && isdigit((unsigned char)c));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (c == '\0') { break; }
|
if (c == '\0') { break; }
|
||||||
|
|
|
@ -1507,7 +1507,7 @@ static int openssl_delete_cert_info(void) {
|
||||||
progname = diag_get_string('p');
|
progname = diag_get_string('p');
|
||||||
envprefix[0] = '\0'; strncat(envprefix, progname, XIO_ENVNAMELEN-1);
|
envprefix[0] = '\0'; strncat(envprefix, progname, XIO_ENVNAMELEN-1);
|
||||||
l = strlen(envprefix);
|
l = strlen(envprefix);
|
||||||
for (i = 0; i < l; ++i) envprefix[i] = toupper(envprefix[i]);
|
for (i = 0; i < l; ++i) envprefix[i] = toupper((unsigned char)envprefix[i]);
|
||||||
strncat(envprefix+l, "_OPENSSL_", XIO_ENVNAMELEN-l-1);
|
strncat(envprefix+l, "_OPENSSL_", XIO_ENVNAMELEN-l-1);
|
||||||
|
|
||||||
#if HAVE_VAR_ENVIRON
|
#if HAVE_VAR_ENVIRON
|
||||||
|
|
|
@ -1524,7 +1524,7 @@ int retropt_socket_pf(struct opt *opts, int *pf) {
|
||||||
char *pfname;
|
char *pfname;
|
||||||
|
|
||||||
if (retropt_string(opts, OPT_PROTOCOL_FAMILY, &pfname) >= 0) {
|
if (retropt_string(opts, OPT_PROTOCOL_FAMILY, &pfname) >= 0) {
|
||||||
if (isdigit(pfname[0])) {
|
if (isdigit((unsigned char)pfname[0])) {
|
||||||
*pf = strtoul(pfname, NULL /*!*/, 0);
|
*pf = strtoul(pfname, NULL /*!*/, 0);
|
||||||
#if WITH_IP4
|
#if WITH_IP4
|
||||||
} else if (!strcasecmp("inet", pfname) ||
|
} else if (!strcasecmp("inet", pfname) ||
|
||||||
|
|
Loading…
Reference in a new issue