jkparis/openlava — comment on commit 3b733b1e3aeb4d6749e3cca00fb49ad7ba97039c
File:  line 0
By openlava:

I see the problem. It is enough to shorten MAXLINELEN with L where L = strlen(gethostname()); The the strcat() of the delimiters would just overwrite the buffer, Bug. Adding +4 works, however the code is broken in its basic trial and error design, consider what happens using L = 1
or L < the first hostname. Instead of first allocating a random, from the perspective of the bytes needed by the algorithm, chunk of bytes and then realloc() we should use 2 loops, first compute the size needed, then allocate, then use the memory().

Pseudo:
for (i = 0; i < hostList->listSize; i++)
size = size + strlen(hostname[i]) + 1 + sizeof(delimiter)
buf = calloc();
n = 0;
for (i = 0; ...)
sprintf(buf + n, "...&n", hostname[i]);

and perhaps use a function to get cleaner code. Remember K&R style is one of the openlava objectives.

Let me know if you are interested in such a patch, otherwise keep using your code and I will fix this later on.

Are you using 2.0 or 1.0 version of openlava?

Thanks, David