#include "cryptlib.h"
#include <openssl/buffer.h>
+size_t BUF_strnlen(const char *str, size_t maxlen)
+ {
+ const char *p;
+
+ for (p = str; *p != '\0' && maxlen-- != 0; ++p)
+ ;
+
+ return p - str;
+ }
+
char *BUF_strdup(const char *str)
{
if (str == NULL) return(NULL);
if (str == NULL) return(NULL);
- len = strlen(str);
+ len = BUF_strnlen(str, siz);
if (siz > len)
siz = len;
void BUF_MEM_free(BUF_MEM *a);
int BUF_MEM_grow(BUF_MEM *str, size_t len);
int BUF_MEM_grow_clean(BUF_MEM *str, size_t len);
+size_t BUF_strnlen(const char *str, size_t maxlen);
char * BUF_strdup(const char *str);
char * BUF_strndup(const char *str, size_t siz);
void * BUF_memdup(const void *data, size_t siz);