SerialGSM icon indicating copy to clipboard operation
SerialGSM copied to clipboard

Using sprintf() instead of strcpy() increases library size for no reason

Open JM-FRANCE opened this issue 7 years ago • 0 comments

On an arduino calling sscanf() or sprintf() adds a giant function to the code base. It’s sometimes a necessary evil but in your case you should replace all the sprintf(xxxxxx,"%s",var1); by strcpy(xxxxxx,var1); As you only copy the string.

Ideally you would make this more robust with strncpy() and taking into account buffer size and the possible needed addition of a trailing ‘\0’

JM-FRANCE avatar Oct 04 '17 02:10 JM-FRANCE