Improve code security posture by replacing sprintf with a safer function.
This commit is contained in:
parent
1a7e303f97
commit
f3ad05347e
16 changed files with 75 additions and 69 deletions
|
@ -536,6 +536,18 @@ public:
|
|||
static void stdsprintf(std::string &s,const char *fmt,...)
|
||||
throw(std::bad_alloc,std::length_error);
|
||||
|
||||
/**
|
||||
* Variant of snprintf that is portable and throws an exception
|
||||
*
|
||||
* @param buf Buffer to write to
|
||||
* @param len Length of buffer in bytes
|
||||
* @param fmt Format string
|
||||
* @param ... Format arguments
|
||||
* @throws std::length_error buf[] too short (buf[] will still be left null-terminated)
|
||||
*/
|
||||
static unsigned int snprintf(char *buf,unsigned int len,const char *fmt,...)
|
||||
throw(std::length_error);
|
||||
|
||||
/**
|
||||
* Count the number of bits set in an integer
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue