]> git.stg.codes - stg.git/blobdiff - libs/smux/der_encoder.c
Fix Boost package name.
[stg.git] / libs / smux / der_encoder.c
index 6c859e1b08bba9600c97970df2fceede5716ddc0..1c014802a8e815e1adac5b320e2fdc3dfd7c0256 100644 (file)
@@ -80,8 +80,8 @@ der_write_tags(asn_TYPE_descriptor_t *sd,
                ber_tlv_tag_t tag,      /* EXPLICIT or IMPLICIT tag */
                asn_app_consume_bytes_f *cb,
                void *app_key) {
-       ber_tlv_tag_t *tags;    /* Copy of tags stream */
-       int tags_count;         /* Number of tags */
+       const ber_tlv_tag_t *tags;      /* Copy of tags stream */
+       int tags_count;                 /* Number of tags */
        size_t overall_length;
        ssize_t *lens;
        int i;
@@ -102,8 +102,9 @@ der_write_tags(asn_TYPE_descriptor_t *sd,
                 * and initialize it appropriately.
                 */
                int stag_offset;
-               tags = (ber_tlv_tag_t *)alloca((sd->tags_count + 1) * sizeof(ber_tlv_tag_t));
-               if(!tags) {     /* Can fail on !x86 */
+               ber_tlv_tag_t *tags_buf;
+               tags_buf = (ber_tlv_tag_t *)alloca((sd->tags_count + 1) * sizeof(ber_tlv_tag_t));
+               if(!tags_buf) { /* Can fail on !x86 */
                        errno = ENOMEM;
                        return -1;
                }
@@ -111,10 +112,11 @@ der_write_tags(asn_TYPE_descriptor_t *sd,
                        + 1     /* EXPLICIT or IMPLICIT tag is given */
                        - ((tag_mode == -1) && sd->tags_count);
                /* Copy tags over */
-               tags[0] = tag;
+               tags_buf[0] = tag;
                stag_offset = -1 + ((tag_mode == -1) && sd->tags_count);
                for(i = 1; i < tags_count; i++)
-                       tags[i] = sd->tags[i + stag_offset];
+                       tags_buf[i] = sd->tags[i + stag_offset];
+               tags = tags_buf;
        } else {
                tags = sd->tags;
                tags_count = sd->tags_count;