fixing bug with multiple own keys sync
authorVolker Birk <vb@pep.foundation>
Sat, 15 Sep 2018 12:01:08 +0200
branchsync
changeset 2944ae169deb521c
parent 2927 bab83a0e7f46
child 2945 8c2cc198fc8d
fixing bug with multiple own keys
sync/gen_statemachine.ysl2
     1.1 --- a/sync/gen_statemachine.ysl2	Tue Sep 04 15:39:20 2018 +0200
     1.2 +++ b/sync/gen_statemachine.ysl2	Sat Sep 15 12:01:08 2018 +0200
     1.3 @@ -436,17 +436,26 @@
     1.4  
     1.5                  for (identity_list *li = channels; li && li->ident ; li = li->next) {
     1.6                      message *_m = NULL;
     1.7 -
     1.8 +                    char *_data = NULL;
     1.9 +                    
    1.10 +                    _data = malloc(size);
    1.11 +                    assert(_data);
    1.12 +                    if (!_data) {
    1.13 +                        status = PEP_OUT_OF_MEMORY;
    1.14 +                        goto the_end;
    1.15 +                    }
    1.16 +                    memcpy(_data, data, size);
    1.17                      status = base_prepare_message(
    1.18                              li->ident,
    1.19                              li->ident,
    1.20 -                            data,
    1.21 +                            _data,
    1.22                              size,
    1.23                              &_m
    1.24                          );
    1.25 -                    if (status)
    1.26 +                    if (status) {
    1.27 +                        free(_data);
    1.28                          goto the_end;
    1.29 -                    data = NULL;
    1.30 +                    }
    1.31  
    1.32                      switch (message_type) {
    1.33                      `` for "fsm/message[@security='unencrypted']" |>>> case «../@name»__payload_PR_«yml:mixedCase(@name)»: