AnsweredAssumed Answered

snprintf hardfaulting on buffer of zero length

Question asked by Jaap Hollander on Jun 22, 2018
Latest reply on Jul 19, 2018 by Jaap Hollander

Hi all,

 

Today I noticed that when using redlib's snprintf in the manner below results in an hardfault on my cortex m3 cpu.

 

length = snprintf(NULL, 0, "Test: %s", "test123");

 

I'd expect it to return the length of the string, but it didn't...

What am i doing wrong?

 

Kind Regards,

Jaap

Outcomes