|
|
@@ -5,12 +5,6 @@
|
|
|
|
|
|
#include "bh_common.h"
|
|
|
|
|
|
-#ifdef RSIZE_MAX
|
|
|
-#undef RSIZE_MAX
|
|
|
-#endif
|
|
|
-
|
|
|
-#define RSIZE_MAX 0x7FFFFFFF
|
|
|
-
|
|
|
int
|
|
|
b_memcpy_s(void *s1, unsigned int s1max, const void *s2, unsigned int n)
|
|
|
{
|
|
|
@@ -20,7 +14,7 @@ b_memcpy_s(void *s1, unsigned int s1max, const void *s2, unsigned int n)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- if (s1 == NULL || s1max > RSIZE_MAX) {
|
|
|
+ if (s1 == NULL) {
|
|
|
return -1;
|
|
|
}
|
|
|
if (s2 == NULL || n > s1max) {
|
|
|
@@ -40,7 +34,7 @@ b_memmove_s(void *s1, unsigned int s1max, const void *s2, unsigned int n)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- if (s1 == NULL || s1max > RSIZE_MAX) {
|
|
|
+ if (s1 == NULL) {
|
|
|
return -1;
|
|
|
}
|
|
|
if (s2 == NULL || n > s1max) {
|
|
|
@@ -54,8 +48,7 @@ b_memmove_s(void *s1, unsigned int s1max, const void *s2, unsigned int n)
|
|
|
int
|
|
|
b_strcat_s(char *s1, unsigned int s1max, const char *s2)
|
|
|
{
|
|
|
- if (NULL == s1 || NULL == s2 || s1max < (strlen(s1) + strlen(s2) + 1)
|
|
|
- || s1max > RSIZE_MAX) {
|
|
|
+ if (NULL == s1 || NULL == s2 || s1max < (strlen(s1) + strlen(s2) + 1)) {
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
@@ -66,8 +59,7 @@ b_strcat_s(char *s1, unsigned int s1max, const char *s2)
|
|
|
int
|
|
|
b_strcpy_s(char *s1, unsigned int s1max, const char *s2)
|
|
|
{
|
|
|
- if (NULL == s1 || NULL == s2 || s1max < (strlen(s2) + 1)
|
|
|
- || s1max > RSIZE_MAX) {
|
|
|
+ if (NULL == s1 || NULL == s2 || s1max < (strlen(s2) + 1)) {
|
|
|
return -1;
|
|
|
}
|
|
|
|