[Radiance-general] new evalglare version available

Lars O. Grobe grobe at gmx.net
Sat Feb 18 02:45:59 PST 2012


Hi!

First of all, thank you Jan for providing us with an improved release of
evalglare!

> I have the following warning when compiling:
> *********************
> In function ‘strcpy’,
>     inlined from ‘main’ at evalglare.c:1194:8:
> /usr/include/bits/string3.h:105:3: warning: call to
> __builtin___strcpy_chk will always overflow destination buffer
> *********************

Hm, honestly evalglare contains quite a lot of code handling strings in
a rather risky way. E.g. the mentioned warning results from using strcpy
without checking that enough memory is available for the version string
- which results in compiler warnings (the best thing to happen) or
crashes. In this specific case, you can simply reserve some more memory
for the version string changing the line 1149 from

char file_out[500], file_out2[500], blank[1], version[40];

to

char file_out[500], file_out2[500], blank[1], version[64];

But of course the next change in the version string may break this
again. It would probably make a lot of sense to use defines for the
string operations (the whole version variable is not really needed
here), or at least set a variable to the maximum string length (Radiance
has MAXSTR) and check that what you copy into a string never exceeds
this (using strlen).

Cheers, Lars.



More information about the Radiance-general mailing list