mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
AppleM1: Update openssl to v1.1.1l
This commit is contained in:
parent
1fe12b8e8c
commit
b787656eea
990 changed files with 13406 additions and 18710 deletions
29
trunk/3rdparty/openssl-1.1-fit/crypto/o_str.c
vendored
29
trunk/3rdparty/openssl-1.1-fit/crypto/o_str.c
vendored
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2003-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2003-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
|
@ -220,10 +220,29 @@ char *OPENSSL_buf2hexstr(const unsigned char *buffer, long len)
|
|||
|
||||
int openssl_strerror_r(int errnum, char *buf, size_t buflen)
|
||||
{
|
||||
#if defined(_MSC_VER) && _MSC_VER>=1400
|
||||
#if defined(_MSC_VER) && _MSC_VER>=1400 && !defined(_WIN32_WCE)
|
||||
return !strerror_s(buf, buflen, errnum);
|
||||
#elif defined(_GNU_SOURCE)
|
||||
return strerror_r(errnum, buf, buflen) != NULL;
|
||||
char *err;
|
||||
|
||||
/*
|
||||
* GNU strerror_r may not actually set buf.
|
||||
* It can return a pointer to some (immutable) static string in which case
|
||||
* buf is left unused.
|
||||
*/
|
||||
err = strerror_r(errnum, buf, buflen);
|
||||
if (err == NULL || buflen == 0)
|
||||
return 0;
|
||||
/*
|
||||
* If err is statically allocated, err != buf and we need to copy the data.
|
||||
* If err points somewhere inside buf, OPENSSL_strlcpy can handle this,
|
||||
* since src and dest are not annotated with __restrict and the function
|
||||
* reads src byte for byte and writes to dest.
|
||||
* If err == buf we do not have to copy anything.
|
||||
*/
|
||||
if (err != buf)
|
||||
OPENSSL_strlcpy(buf, err, buflen);
|
||||
return 1;
|
||||
#elif (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || \
|
||||
(defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 600)
|
||||
/*
|
||||
|
@ -234,6 +253,7 @@ int openssl_strerror_r(int errnum, char *buf, size_t buflen)
|
|||
return !strerror_r(errnum, buf, buflen);
|
||||
#else
|
||||
char *err;
|
||||
|
||||
/* Fall back to non-thread safe strerror()...its all we can do */
|
||||
if (buflen < 2)
|
||||
return 0;
|
||||
|
@ -241,8 +261,7 @@ int openssl_strerror_r(int errnum, char *buf, size_t buflen)
|
|||
/* Can this ever happen? */
|
||||
if (err == NULL)
|
||||
return 0;
|
||||
strncpy(buf, err, buflen - 1);
|
||||
buf[buflen - 1] = '\0';
|
||||
OPENSSL_strlcpy(buf, err, buflen);
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue