xlat.c: use xsnprintf instead of sprintf

* xlat.c: Include "xstring.h".
(sprintflags): Replace sprintf with xsnprintf.
This commit is contained in:
Дмитрий Левин 2018-01-06 01:45:16 +00:00
parent b75f886706
commit 6e67a2b71e

4
xlat.c
View File

@ -30,6 +30,7 @@
*/
#include "defs.h"
#include "xstring.h"
#include <stdarg.h>
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;