From 6e67a2b71e7471c467182fd1ed30f8f1e691ba10 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Sat, 6 Jan 2018 01:45:16 +0000 Subject: [PATCH] xlat.c: use xsnprintf instead of sprintf * xlat.c: Include "xstring.h". (sprintflags): Replace sprintf with xsnprintf. --- xlat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xlat.c b/xlat.c index ad49720d..5e2dfff8 100644 --- a/xlat.c +++ b/xlat.c @@ -30,6 +30,7 @@ */ #include "defs.h" +#include "xstring.h" #include const char * @@ -175,7 +176,8 @@ sprintflags(const char *prefix, const struct xlat *xlat, uint64_t flags) if (flags) { if (found) *outptr++ = '|'; - outptr += sprintf(outptr, "%#" PRIx64, flags); + outptr += xsnprintf(outptr, sizeof(outstr) - (outptr - outstr), + "%#" PRIx64, flags); } return outstr;