summaryrefslogtreecommitdiff
path: root/src/http_decoder_utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/http_decoder_utils.cpp')
-rw-r--r--src/http_decoder_utils.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/http_decoder_utils.cpp b/src/http_decoder_utils.cpp
new file mode 100644
index 0000000..77d716d
--- /dev/null
+++ b/src/http_decoder_utils.cpp
@@ -0,0 +1,21 @@
+/*
+**********************************************************************************************
+* File: http_decoder_utils.c
+* Description:
+* Authors: LuWenPeng <[email protected]>
+* Date: 2022-10-31
+* Copyright: (c) Since 2022 Geedge Networks, Ltd. All rights reserved.
+***********************************************************************************************
+*/
+#include <string.h>
+#include "http_decoder_inc.h"
+
+char *safe_dup(const char *str, size_t len)
+{
+ if (str == NULL || len == 0) {
+ return NULL;
+ }
+ char *dup = CALLOC(char, len + 1);
+ memcpy(dup, str, len);
+ return dup;
+} \ No newline at end of file