MOD5213 siprintf()

Discussion to talk about software related topics only.
Post Reply
Posts: 85
Joined: Mon Apr 28, 2008 7:32 am

MOD5213 siprintf()

Post by joepasquariello » Wed Apr 10, 2019 5:59 pm

Hello NB,

I'm using 2.7.7 tools with MOD5213. The siprintf() in the system_nn library does not NULL-terminate its output string. I checked the system library, and the string functions there do add a NULL-terminator, along with a comment that the NULL-terminator is required when the format string is empty. The comment is incorrect in the sense that a NULL-terminator should be added in every case.

The forum contains only one thread with both "MOD5213" and "siprintf", and it wasn't actually a question about siprintf(), so maybe I'm the first person to use this function? Serves me right for sticking with STDIO all these years.

A work-around is to explicitly add a NULL terminator when using siprintf().

before siprintf( s, "%1d", intval );
after siprintf( s, "%1d%c", intval, '\0' );

The standard function sprintf() does correctly include a NULL terminator.



Post Reply