Problem with memset

I just freshly cloned the project files and didnt change anything. The Program tells me “Call to function “memset” is insecure as it does not provide security checks introduced in the C11 standard.”
What do I need to change? I use the VM.

Hello Gerrit,

Is it complaining about a memset call existing in the unchanged source files of the project or in any file you’ve modified/wrote own code for any task into?

As far as I am aware of, there’s only one call of this function in energy.c's image_init function. Did this produce this message? Does the error message even tell you where the error is coming from? Does this warning popup when you run make or how could one reproduce your situation?

These things might be important information to get behind this behaviour :smiley:

Looking forward to your answer,

The warning tells you that you need to be careful when calling memset since if you are not, you will just override arbitrary memory.

As long as you have written your code such that this does not happen, you have nothing to worry about.

However, since it’s easy to make mistakes (you will realize this soon enough :slightly_smiling_face:), modern C has variants of memset that are supposed to have some sanity checks, which abort your program instead of having undefined behavior.

That’s what this warning tells you. I’m not sure whether you can use these new functions in the project, but you can try. As mentioned, you do not need to and can ignore the warning if you are certain that you never call memset wrongly. If you are not certain, try making sure of this before changing memset to the modern memset.