feat(userspace): Add more functions to banned.h.

These include:
* vsprintf()
* sprintf()
* strcat()
* strncat()
* strncpy()
* swprintf()
* vswprintf()

This also changes `userspace/falco/logger.cpp` to remove a `sprintf`
statement. The statement did not affect the codebase in any form so
it was simply removed rather than being substituted.

Fixes #1035

Signed-off-by: Vaibhav <vrongmeal@gmail.com>
This commit is contained in:
Vaibhav 2020-02-05 07:32:40 +05:30 committed by poiana
parent 488e667f46
commit 1c80c1f458
2 changed files with 23 additions and 6 deletions

View File

@ -23,3 +23,24 @@ limitations under the License.
#undef strcpy
#define strcpy(a, b) BAN(strcpy)
#undef vsprintf
#define vsprintf(a, b, c) BAN(vsprintf)
#undef sprintf
#define sprintf(a, b, ...) BAN(sprintf)
#undef strcat
#define strcat(a, b) BAN(strcat)
#undef strncat
#define strncat(a, b, c) BAN(strncat)
#undef strncpy
#define strncpy(a, b, c) BAN(strncpy)
#undef swprintf
#define swprintf(a, b, c, ...) BAN(swprintf)
#undef vswprintf
#define vswprintf(a, b, c, d) BAN(vswprintf)

View File

@ -131,12 +131,8 @@ void falco_logger::log(int priority, const string msg)
{
char buf[sizeof "YYYY-MM-DDTHH:MM:SS-0000"];
struct tm *gtm = std::gmtime(&result);
if(gtm == NULL ||
(strftime(buf, sizeof(buf), "%FT%T%z", gtm) == 0))
{
sprintf(buf, "N/A");
}
else
if(gtm != NULL &&
(strftime(buf, sizeof(buf), "%FT%T%z", gtm) != 0))
{
fprintf(stderr, "%s: %s", buf, msg.c_str());
}