summaryrefslogtreecommitdiff
path: root/lib/coding.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2011-08-30 17:07:21 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2011-08-30 17:07:21 +0200
commit58cda71590f48db415e0005f2513da53944063d1 (patch)
treedf5398fe623940393f96bbb905479678e67353f5 /lib/coding.c
parent22467f04196c52ebfdf14255748de1b977bff865 (diff)
downloadlibtasn1-58cda71590f48db415e0005f2513da53944063d1.tar.gz
libtasn1-58cda71590f48db415e0005f2513da53944063d1.tar.bz2
libtasn1-58cda71590f48db415e0005f2513da53944063d1.zip
small optimization
Diffstat (limited to 'lib/coding.c')
-rw-r--r--lib/coding.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/coding.c b/lib/coding.c
index 111e063..3cc0ef8 100644
--- a/lib/coding.c
+++ b/lib/coding.c
@@ -256,15 +256,17 @@ _asn1_objectid_der (unsigned char *str, unsigned char *der, int *der_len)
char *temp, *n_end, *n_start;
unsigned char bit7;
unsigned long val, val1 = 0;
+ int str_len = strlen(str);
max_len = *der_len;
- temp = (char *) _asn1_malloc (strlen (str) + 2);
+ temp = _asn1_malloc (str_len + 2);
if (temp == NULL)
return ASN1_MEM_ALLOC_ERROR;
- strcpy (temp, str);
- strcat (temp, ".");
+ memcpy (temp, str, str_len);
+ temp[str_len] = '.';
+ temp[str_len+1] = 0;
counter = 0;
n_start = temp;