276da39af9
Approved by: roberto, delphij Security: VuXML: 0d0f3050-1f69-11e5-9ba9-d050996490d0 Security: http://bugs.ntp.org/show_bug.cgi?id=2853 Security: https://www.kb.cert.org/vuls/id/668167 Security: http://support.ntp.org/bin/view/Main/SecurityNotice#June_2015_NTP_Security_Vulnerabi
30 lines
386 B
C
30 lines
386 B
C
#include <config.h>
|
|
|
|
#include <ntp_assert.h>
|
|
#include "ntp_malloc.h"
|
|
#include <string.h>
|
|
|
|
#ifndef HAVE_STRDUP
|
|
|
|
char *strdup(const char *s);
|
|
|
|
char *
|
|
strdup(
|
|
const char *s
|
|
)
|
|
{
|
|
size_t octets;
|
|
char * cp;
|
|
|
|
REQUIRE(s);
|
|
octets = strlen(s) + 1;
|
|
if ((cp = malloc(octets)) == NULL)
|
|
return NULL;
|
|
memcpy(cp, s, octets);
|
|
|
|
return cp;
|
|
}
|
|
#else
|
|
int strdup_c_nonempty_compilation_unit;
|
|
#endif
|