Open broukema opened 3 years ago
Thanks broukema. Let me have a look.
Darren, my name is actually "Boud" (lower case is fine in this context, of course - boud) :), not broukema. The broukema alias is only because someone else than me grabbed 'boud' on github before I did... :P
@darrencroton
While I said "request changes", really the only necessary change is the first one
And many thanks for this PR and improving the code quality!
@manodeep So I see that "conversation" is another non-git service that github provides on top of git and risks creating vendor lock-in, because it's not easy to shift to other git repository hosters, and is nevertheless useful for people who wish to trace what happened, when and why in order to debug or tidy up code.
Anyway, I've updated this pull request. Thanks for the review! :)
Gcc-10.2.0 gives many compile warnings of the risk of string buffer overflows. The uncontrolled
sprintf
commands risk segmentation violations if long path lengths are used, and risk security problems more generally, which is why the warnings exist.This commit aims to reduce the chance of buffer overflows by using
snprintf
instead ofsprintf
and extending from just the C preprocesor macro MAX_STRING_LEN to extra macros MAX_BUF_SIZE and MAX_OUTFILE_SIZE, defined e.g. as (3*MAX_STRING_LEN+40). A few unused variables are also commented out in response to the recommendations from gcc.This commit compiles cleanly for me with gcc-10.2.0, with
make OPTIONS=-fcommon
to work around Issue https://github.com/darrencroton/sage/issues/16 .