Add a temporary snprintf, so that safely-written code can at least
compile, even if it won't yet be safe.
This commit is contained in:
parent
8df7e74990
commit
a42092d2a0
@ -173,6 +173,17 @@ int sprintf(char *buf, const char *fmt, ...)
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#warning "Remove this buffer-overflow-in-waiting at some point"
|
||||||
|
int snprintf ( char *buf, size_t size, const char *fmt, ... ) {
|
||||||
|
va_list args;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
va_start ( args, fmt );
|
||||||
|
i = vsprintf ( buf, fmt, args );
|
||||||
|
va_end ( args );
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a formatted string to the console.
|
* Write a formatted string to the console.
|
||||||
*
|
*
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
extern int sprintf ( char *buf, const char *fmt, ... );
|
extern int sprintf ( char *buf, const char *fmt, ... );
|
||||||
|
extern int snprintf ( char *buf, size_t size, const char *fmt, ... );
|
||||||
extern int printf ( const char *fmt, ... );
|
extern int printf ( const char *fmt, ... );
|
||||||
|
|
||||||
#endif /* VSPRINTF_H */
|
#endif /* VSPRINTF_H */
|
||||||
|
Reference in New Issue
Block a user