Remove sprintf
Remove sprintf as if you can't easily use snprintf then you probably have buffer overflow. Change-Id: Ic4570e099a52d743aca938a2bfadb95981adc503 Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com> Reviewed-on: http://review.coreboot.org/4280 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
parent
a37383db80
commit
54124d3e56
|
@ -57,20 +57,6 @@ static int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sprintf(char *buf, const char *fmt, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
va_start(args, fmt);
|
|
||||||
/* A trick: we have at most (size_t)-1 adressable space anyway, so
|
|
||||||
if we output so much we'll crash anyway. */
|
|
||||||
i = vsnprintf(buf, -1, fmt, args);
|
|
||||||
va_end(args);
|
|
||||||
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
int snprintf(char *buf, size_t size, const char *fmt, ...)
|
int snprintf(char *buf, size_t size, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
|
@ -16,7 +16,6 @@ void *memset(void *s, int c, size_t n);
|
||||||
int memcmp(const void *s1, const void *s2, size_t n);
|
int memcmp(const void *s1, const void *s2, size_t n);
|
||||||
void *memchr(const void *s, int c, size_t n);
|
void *memchr(const void *s, int c, size_t n);
|
||||||
#if !defined(__PRE_RAM__)
|
#if !defined(__PRE_RAM__)
|
||||||
int sprintf(char * buf, const char *fmt, ...);
|
|
||||||
int snprintf(char * buf, size_t size, const char *fmt, ...);
|
int snprintf(char * buf, size_t size, const char *fmt, ...);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue