Translated sprintf calls into snprintf.
authorEric Pouech <eric.pouech@wanadoo.fr>
Tue, 11 Feb 2003 22:07:16 +0000 (22:07 +0000)
committerAlexandre Julliard <julliard@winehq.org>
Tue, 11 Feb 2003 22:07:16 +0000 (22:07 +0000)
programs/winedbg/ext_debugger.c
programs/winedbg/hash.c
programs/winedbg/module.c
programs/winedbg/source.c

index f28fd0318db5bcfbf204d7ff8e4959eb09d990f0..6c913b0634a5b7efcd7a3b4ca7692120d1a24687 100644 (file)
@@ -129,7 +129,7 @@ void DEBUG_ExternalDebugger(void)
     memset(pid_string, 0, DBG_BUFF_SIZE);
 
     /* make pid into string */
-    sprintf(pid_string, "%ld", (long) attach_pid);
+    snprintf(pid_string, sizeof(pid_string), "%ld", (long) attach_pid);
 
     /* now exec the debugger to get it's own clean memory space */
     if (dbg_no_xterm)
index 1c67a72d419e52e1c11e775b14aebc52c55ba449..9d350ba516cfab8ec7a3b43007455cb751b7644e 100644 (file)
@@ -721,7 +721,7 @@ const char * DEBUG_FindNearestSymbol( const DBG_ADDR *addr, int flag,
                strcat(arglist, ", ");
              }
            DEBUG_READ_MEM_VERBOSE(ptr, &val, sizeof(val));
-           sprintf(argtmp, "%s=0x%x", nearest->local_vars[i].name, val);
+           snprintf(argtmp, sizeof(argtmp), "%s=0x%x", nearest->local_vars[i].name, val);
 
            strcat(arglist, argtmp);
          }
@@ -736,7 +736,7 @@ const char * DEBUG_FindNearestSymbol( const DBG_ADDR *addr, int flag,
        char*   ptr = strrchr(module->module_name, '/');
 
        if (!ptr++) ptr = module->module_name;
-       sprintf( modbuf, " in %s", ptr);
+       snprintf( modbuf, sizeof(modbuf), " in %s", ptr);
     }
     else
        modbuf[0] = '\0';
@@ -765,7 +765,7 @@ const char * DEBUG_FindNearestSymbol( const DBG_ADDR *addr, int flag,
 
        if( lineno != -1 )
          {
-           sprintf(linebuff, ":%d", lineno);
+           snprintf(linebuff, sizeof(linebuff), ":%d", lineno);
            lineinfo = linebuff;
            if( source != NULL )
              {
@@ -779,22 +779,22 @@ const char * DEBUG_FindNearestSymbol( const DBG_ADDR *addr, int flag,
         else sourcefile++;
 
        if (addr->off == nearest->value.addr.off)
-         sprintf( name_buffer, "%s%s [%s%s]%s", nearest->name,
+         snprintf( name_buffer, sizeof(name_buffer), "%s%s [%s%s]%s", nearest->name,
                   arglist, sourcefile, lineinfo, modbuf);
        else
-         sprintf( name_buffer, "%s+0x%lx%s [%s%s]%s", nearest->name,
+         snprintf( name_buffer, sizeof(name_buffer), "%s+0x%lx%s [%s%s]%s", nearest->name,
                   addr->off - nearest->value.addr.off,
                   arglist, sourcefile, lineinfo, modbuf );
       }
     else
       {
        if (addr->off == nearest->value.addr.off)
-         sprintf( name_buffer, "%s%s%s", nearest->name, arglist, modbuf);
+         snprintf( name_buffer, sizeof(name_buffer), "%s%s%s", nearest->name, arglist, modbuf);
        else {
          if (addr->seg && (nearest->value.addr.seg!=addr->seg))
              return NULL;
          else
-             sprintf( name_buffer, "%s+0x%lx%s%s", nearest->name,
+             snprintf( name_buffer, sizeof(name_buffer), "%s+0x%lx%s%s", nearest->name,
                       addr->off - nearest->value.addr.off, arglist, modbuf);
        }
       }
index add3bee47dea1b84fb8318bb86c66bf76f393f98..3a957b18739b95315c23b7d3169ef9229d7be05b 100644 (file)
@@ -246,7 +246,7 @@ static void DEBUG_LoadModule16(HMODULE hModule, NE_MODULE* module, char* moduleA
     cpnt += 1 + buf[0] + sizeof(WORD);
 
     while (DEBUG_READ_MEM_VERBOSE(cpnt, buf, sizeof(buf)) && buf[0]) {
-       sprintf(epname, "%s.%.*s", name, buf[0], &buf[1]);
+       snprintf(epname, sizeof(epname), "%s.%.*s", name, buf[0], &buf[1]);
        if (DEBUG_GetEP16(moduleAddr, module, *(WORD*)&buf[1 + buf[0]], &value.addr)) {
            DEBUG_AddSymbol(epname, &value, NULL, SYM_WIN32 | SYM_FUNC);
        }
@@ -257,7 +257,7 @@ static void DEBUG_LoadModule16(HMODULE hModule, NE_MODULE* module, char* moduleA
     if (!module->nrname_handle) return;  /* No non-resident table */
     cpnt = (char *)GlobalLock16(module->nrname_handle);
     while (DEBUG_READ_MEM_VERBOSE(cpnt, buf, sizeof(buf)) && buf[0]) {
-       sprintf(epname, "%s.%.*s", name, buf[0], &buf[1]);
+       snprintf(epname, sizeof(epname), "%s.%.*s", name, buf[0], &buf[1]);
        if (DEBUG_GetEP16(moduleAddr, module, *(WORD*)&buf[1 + buf[0]], &value.addr)) {
            DEBUG_AddSymbol(epname, &value, NULL, SYM_WIN32 | SYM_FUNC);
        }
index bb3038614d3f1510926c9404a16a1b6141ee94ca..4b72975e62cfcc6e9980ba3b13ee337f58c03dc3 100644 (file)
@@ -215,7 +215,7 @@ DEBUG_DisplaySource(char * sourcefile, int start, int end)
                     /*
                      * Still couldn't find it.  Ask user for path to add.
                      */
-                    sprintf(zbuf, "Enter path to file '%s': ", sourcefile);
+                    snprintf(zbuf, sizeof(zbuf), "Enter path to file '%s': ", sourcefile);
                     DEBUG_ReadLine(zbuf, tmppath, sizeof(tmppath));
 
                     if ( tmppath[strlen(tmppath)-1] != '/' )