You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.2 KiB
63 lines
1.2 KiB
4 years ago
|
/*
|
||
|
* Copyright (c) 2020 Bitdefender
|
||
|
* SPDX-License-Identifier: Apache-2.0
|
||
|
*/
|
||
3 months ago
|
#include "include/bddisasm_crt.h"
|
||
4 years ago
|
|
||
|
//
|
||
|
// nd_strcat_s
|
||
|
//
|
||
|
char *
|
||
|
nd_strcat_s(
|
||
|
char *dst,
|
||
2 years ago
|
ND_SIZET dst_size,
|
||
4 years ago
|
const char *src
|
||
|
)
|
||
|
{
|
||
|
char *p;
|
||
2 years ago
|
ND_SIZET available;
|
||
4 years ago
|
|
||
|
p = dst;
|
||
|
available = dst_size;
|
||
|
while (available > 0 && *p != 0)
|
||
|
{
|
||
|
p++;
|
||
|
available--;
|
||
|
}
|
||
|
|
||
|
if (available == 0)
|
||
|
{
|
||
|
nd_memzero(dst, dst_size);
|
||
2 years ago
|
return (char *)ND_NULL;
|
||
4 years ago
|
}
|
||
|
|
||
|
while ((*p++ = *src++) != 0 && --available > 0);
|
||
|
|
||
|
if (available == 0)
|
||
|
{
|
||
|
nd_memzero(dst, dst_size);
|
||
2 years ago
|
return (char *)ND_NULL;
|
||
4 years ago
|
}
|
||
|
|
||
|
return dst;
|
||
|
}
|
||
3 years ago
|
|
||
|
#if !defined(BDDISASM_NO_FORMAT) && defined(BDDISASM_HAS_VSNPRINTF)
|
||
|
#include <stdio.h>
|
||
|
|
||
2 years ago
|
int nd_vsnprintf_s(char *buffer, ND_SIZET sizeOfBuffer, ND_SIZET count, const char *format, va_list argptr)
|
||
3 years ago
|
{
|
||
|
UNREFERENCED_PARAMETER(count);
|
||
|
return vsnprintf(buffer, sizeOfBuffer, format, argptr);
|
||
|
}
|
||
|
#endif // !defined(BDDISASM_NO_FORMAT) && defined(BDDISASM_HAS_VSNPRINTF)
|
||
|
|
||
2 years ago
|
#if defined(BDDISASM_HAS_MEMSET)
|
||
3 years ago
|
#include <string.h>
|
||
|
|
||
2 years ago
|
void *nd_memset(void *s, int c, ND_SIZET n)
|
||
3 years ago
|
{
|
||
|
return memset(s, c, n);
|
||
|
}
|
||
2 years ago
|
#endif // defined(BDDISASM_HAS_MEMSET)
|