From af06b2d654f1c0178bcd1c7a447c6c2fcf80572e Mon Sep 17 00:00:00 2001 From: Royce Mitchell III Date: Wed, 29 Sep 2004 00:47:42 +0000 Subject: [PATCH] sprintf bad svn path=/trunk/; revision=11114 --- reactos/ntoskrnl/dbg/errinfo.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/reactos/ntoskrnl/dbg/errinfo.c b/reactos/ntoskrnl/dbg/errinfo.c index ec3fb152885..5ca0e9b5e78 100644 --- a/reactos/ntoskrnl/dbg/errinfo.c +++ b/reactos/ntoskrnl/dbg/errinfo.c @@ -204,9 +204,10 @@ DbgGetErrorText(NTSTATUS ErrorCode, PUNICODE_STRING ErrorText, ULONG Flags) { if (NT_CUSTOMER(ErrorCode)) { - sprintf(TempBuf, + _snprintf(TempBuf, sizeof(TempBuf)-1, "%%CUST-%s-", SeverityCodes[NT_SEVERITY(ErrorCode)]); + TempBuf[sizeof(TempBuf)-1] = '\0'; } else { @@ -219,14 +220,16 @@ DbgGetErrorText(NTSTATUS ErrorCode, PUNICODE_STRING ErrorText, ULONG Flags) } if (FacList[i].Name != NULL) { - sprintf(TempBuf, "%%%s-%s-", + _snprintf(TempBuf, sizeof(TempBuf)-1, "%%%s-%s-", FacList[i].Name, SeverityCodes[NT_SEVERITY(ErrorCode)]); + TempBuf[sizeof(TempBuf)-1] = '\0'; } else { - sprintf(TempBuf, "%%UNKNOWN-%s-", + _snprintf(TempBuf, sizeof(TempBuf)-1, "%%UNKNOWN-%s-", SeverityCodes[NT_SEVERITY(ErrorCode)]); + TempBuf[sizeof(TempBuf)-1] = '\0'; } } } @@ -257,7 +260,8 @@ DbgGetErrorText(NTSTATUS ErrorCode, PUNICODE_STRING ErrorText, ULONG Flags) { if (Flags & DBG_GET_SHOW_FACILITY) { - sprintf(NumBuf, "%08lx", ErrorCode); + _snprintf(NumBuf, sizeof(NumBuf)-1, "%08lx", ErrorCode); + NumBuf[sizeof(NumBuf)-1] = '\0'; strcat(TempBuf, NumBuf); strcat(TempBuf, " "); }