naren0nindiatimes / tinyos-main

Automatically exported from code.google.com/p/tinyos-main
0 stars 0 forks source link

no null check on malloc #77

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In sim_noise.c, if malloc returns null, we will crash:

    noiseG = (char *)malloc(sizeof(char)*delta_t);

    for(i=0; i< delta_t; i++) {
      noiseG[i] = sim_noise_gen(node_id);
      arrangeKey(node_id);
      noiseData[node_id].key[NOISE_HISTORY-1] = search_bin_num(noiseG[i]);
    }
    noise = noiseG[delta_t-1];
    noiseData[node_id].lastNoiseVal = noise;

    free(noiseG);

(reported by Marcin Szczodrak)

Original issue reported on code.google.com by gnaw...@gmail.com on 24 Oct 2011 at 10:50

GoogleCodeExporter commented 8 years ago
TOSSIM doesn't check any calls to malloc. But I agree that for noise simulation 
it's much more likely than in other cases, due to the size of files and the 
data structure.

Original comment by philip.l...@gmail.com on 26 Oct 2011 at 4:14

GoogleCodeExporter commented 8 years ago

Original comment by philip.l...@gmail.com on 12 Mar 2012 at 10:26