console/vsprintf: Implement snprintf

snprintf is a safe variant of sprintf. To avoid buffer overflows
we shouldn't use sprintf at all. But for now let's start by
implementing snprintf in first place.

Change-Id: Ic17d94b8cd91b72f66b84b0589a06b8abef5e5c9
Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
Reviewed-on: http://review.coreboot.org/4278
Tested-by: build bot (Jenkins)
Reviewed-by: Peter Stuge <peter@stuge.se>
This commit is contained in:
Vladimir Serbinenko
2013-11-26 22:07:47 +01:00
committed by Peter Stuge
parent 697c1ed1ff
commit 4b5012a4a2
2 changed files with 29 additions and 8 deletions

View File

@ -17,6 +17,7 @@ int memcmp(const void *s1, const void *s2, size_t n);
void *memchr(const void *s, int c, size_t n);
#if !defined(__PRE_RAM__)
int sprintf(char * buf, const char *fmt, ...);
int snprintf(char * buf, size_t size, const char *fmt, ...);
#endif
// simple string functions