commit | 30afef3073e6f9d0c00275b7c41009eb64661f67 | [log] [tgz] |
---|---|---|
author | Harald Welte <laforge@gnumonks.org> | Sun Aug 30 12:28:29 2015 +0200 |
committer | Harald Welte <laforge@gnumonks.org> | Sun Aug 30 12:28:29 2015 +0200 |
tree | eea2959ffd3b0977e18b12a546ce8f2604c1678b | |
parent | b3dae30e5ee3d9109b07023327df1c6c00b06806 [diff] [blame] |
move asn.1 helper functions to asn1helpers.[ch]
diff --git a/src/asn1helpers.c b/src/asn1helpers.c new file mode 100644 index 0000000..fe886e3 --- /dev/null +++ b/src/asn1helpers.c
@@ -0,0 +1,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; +}