sprintf bad
authorRoyce Mitchell III <royce3@ev1.net>
Wed, 29 Sep 2004 00:47:42 +0000 (00:47 +0000)
committerRoyce Mitchell III <royce3@ev1.net>
Wed, 29 Sep 2004 00:47:42 +0000 (00:47 +0000)
svn path=/trunk/; revision=11114

reactos/ntoskrnl/dbg/errinfo.c

index ec3fb15..5ca0e9b 100644 (file)
@@ -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, " ");
         }