55
66#include "bh_common.h"
77
8- #ifdef RSIZE_MAX
9- #undef RSIZE_MAX
10- #endif
11-
12- #define RSIZE_MAX 0x7FFFFFFF
13-
148int
159b_memcpy_s (void * s1 , unsigned int s1max , const void * s2 , unsigned int n )
1610{
@@ -20,7 +14,7 @@ b_memcpy_s(void *s1, unsigned int s1max, const void *s2, unsigned int n)
2014 return 0 ;
2115 }
2216
23- if (s1 == NULL || s1max > RSIZE_MAX ) {
17+ if (s1 == NULL ) {
2418 return -1 ;
2519 }
2620 if (s2 == NULL || n > s1max ) {
@@ -40,7 +34,7 @@ b_memmove_s(void *s1, unsigned int s1max, const void *s2, unsigned int n)
4034 return 0 ;
4135 }
4236
43- if (s1 == NULL || s1max > RSIZE_MAX ) {
37+ if (s1 == NULL ) {
4438 return -1 ;
4539 }
4640 if (s2 == NULL || n > s1max ) {
@@ -54,8 +48,7 @@ b_memmove_s(void *s1, unsigned int s1max, const void *s2, unsigned int n)
5448int
5549b_strcat_s (char * s1 , unsigned int s1max , const char * s2 )
5650{
57- if (NULL == s1 || NULL == s2 || s1max < (strlen (s1 ) + strlen (s2 ) + 1 )
58- || s1max > RSIZE_MAX ) {
51+ if (NULL == s1 || NULL == s2 || s1max < (strlen (s1 ) + strlen (s2 ) + 1 )) {
5952 return -1 ;
6053 }
6154
@@ -66,8 +59,7 @@ b_strcat_s(char *s1, unsigned int s1max, const char *s2)
6659int
6760b_strcpy_s (char * s1 , unsigned int s1max , const char * s2 )
6861{
69- if (NULL == s1 || NULL == s2 || s1max < (strlen (s2 ) + 1 )
70- || s1max > RSIZE_MAX ) {
62+ if (NULL == s1 || NULL == s2 || s1max < (strlen (s2 ) + 1 )) {
7163 return -1 ;
7264 }
7365
0 commit comments