summaryrefslogtreecommitdiff
path: root/src/http_decoder_utils.cpp
blob: 77d716dca188695c3b713c81ddceee1ce2c0f634 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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;
}