Skip to content
Snippets Groups Projects
Commit 7e0d2cb6 authored by Lev Walkin's avatar Lev Walkin
Browse files

portability

parent 659a751c
No related branches found
No related tags found
No related merge requests found
......@@ -367,6 +367,7 @@ OBJECT_IDENTIFIER_set_single_arc(uint8_t *arcbuf, void *arcval, unsigned int arc
uint8_t buffer[arcval_size];
#else
uint8_t *buffer = alloca(arcval_size);
if(!buffer) { errno = ENOMEM; return -1; }
#endif
if(isLittleEndian && !prepared_order) {
......
......@@ -447,6 +447,12 @@ SET_encode_der(asn1_TYPE_descriptor_t *sd,
if(t2m_build_own) {
t2m = alloca(specs->elements_count * sizeof(t2m[0]));
t2m_count = 0;
if(!t2m) { /* There are such platforms */
my_erval.encoded = -1;
my_erval.failed_type = sd;
my_erval.structure_ptr = ptr;
return my_erval;
}
} else {
/*
* There is no untagged CHOICE in this SET.
......
......@@ -108,7 +108,7 @@ _asn_i_log_error(asn_app_consume_bytes_f *cb, void *key, const char *fmt, ...) {
*/
len = ret + 1;
p = alloca(len);
if(!p) return; /* Can't be though. */
if(!p) return; /* Can fail on !x86. */
va_start(ap, fmt);
......
......@@ -60,7 +60,10 @@ der_write_tags(asn1_TYPE_descriptor_t *sd,
*/
int stag_offset;
tags = alloca((sd->tags_count + 1) * sizeof(ber_tlv_tag_t));
if(tags == NULL) return -1; /* Impossible on i386 */
if(!tags) { /* Can fail on !x86 */
errno = ENOMEM;
return -1;
}
tags_count = sd->tags_count
+ 1 /* EXPLICIT or IMPLICIT tag is given */
- ((tag_mode==-1)?sd->tags_impl_skip:0);
......@@ -79,7 +82,10 @@ der_write_tags(asn1_TYPE_descriptor_t *sd,
return 0;
lens = alloca(tags_count * sizeof(lens[0]));
if(lens == NULL) return -1;
if(!lens) {
errno = ENOMEM;
return -1;
}
/*
* Array of tags is initialized.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment