aboutsummaryrefslogtreecommitdiffstats
path: root/src/asn1helpers.c
blob: fe886e337d7fa7304c7bb0b49c4b783367d8c440 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <string.h>

#include <asn1defs.h>

#include "asn1helpers.h"

int asn1_strncpy(char *out, const ASN1String *in, size_t n)
{
	size_t cpylen = n;

	if (in->len < cpylen)
		cpylen = in->len;

	strncpy(out, (char *)in->buf, cpylen);
	out[n-1] = '\0';

	return cpylen;
}