Hi all
As you all know dtostrf convert a float to char array. However the problem is that it does not get the limit in the buffer and it keeps writing in the memory till the number is fully printed.
What is a safe way to make sure this does not happen and the dtostrf become safe. BTW the reasonable part in the question is to make sure solutions such as checking the boundary are out. The main reason for that being the fact that the boundary is dependent on the format and also it takes huge amount of time to compare floats. Also considering that dtostrf actually have to rip float apart before printing make me think it is either better to make a safe dtostrf or efficiently checking the number of digits.
Side note: I posted this on arduino forum and the answers are off topic and not related. https://forum.arduino.cc/index.php?topic=510327.0
thank you.