cn-uofbasel / ccn-lite

CCN-lite, a lightweight implementation of the CCNx protocol and its variations
ISC License
74 stars 63 forks source link

sizeof operand mismatch warning in ccn-lite-rpc.c #324

Closed mfrey closed 5 years ago

mfrey commented 5 years ago

Description

There is a sizeof operand mismatch in ccn-lite-rpc.c

368         nonce->aux = malloc(sizeof(int));

The allocated size is of sizeof(int) but probably should be sizeof(struct rdr_ds_s *). See also the definition of struct rdr_ds_s *aux in ccnl-pkt-localrpc.h

 55 struct rdr_ds_s { // RPC Data Representation (RDR) data structure
 56     int type;
 57     int flatlen;
 58     unsigned char *flat;
 59     struct rdr_ds_s *nextinseq;
 60     union {
 61         struct rdr_ds_s *fct;
 62         struct rdr_ds_s *lambdavar;
 63         unsigned int nonnegintval;
 64         int namelen;
 65         int binlen;
 66         int strlen;
 67     } u;
 68     struct rdr_ds_s *aux;
 69 };
 70 

EDIT: This bug was identified by scan-build.