winedbg: maintenance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



as announced, the rest of sprintf=>snprintf conversion
A+
--
Eric Pouech
Name:          wd_snprintf
ChangeLog:     translated sprintf calls into snprintf
License:       X11
GenDate:       2003/02/01 13:34:52 UTC
ModifiedFiles: programs/winedbg/ext_debugger.c programs/winedbg/hash.c programs/winedbg/module.c programs/winedbg/source.c programs/winedbg/winedbg.c
AddedFiles:    
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/ext_debugger.c,v
retrieving revision 1.1
diff -u -u -r1.1 ext_debugger.c
--- programs/winedbg/ext_debugger.c	13 Sep 2002 17:54:28 -0000	1.1
+++ programs/winedbg/ext_debugger.c	1 Feb 2003 10:34:40 -0000
@@ -129,7 +129,7 @@
     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: programs/winedbg/hash.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/hash.c,v
retrieving revision 1.5
diff -u -u -r1.5 hash.c
--- programs/winedbg/hash.c	13 Jan 2003 18:41:40 -0000	1.5
+++ programs/winedbg/hash.c	1 Feb 2003 10:28:53 -0000
@@ -721,7 +731,7 @@
 		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 +746,7 @@
        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 +775,7 @@
 
 	if( lineno != -1 )
 	  {
-	    sprintf(linebuff, ":%d", lineno);
+	    snprintf(linebuff, sizeof(linebuff), ":%d", lineno);
 	    lineinfo = linebuff;
 	    if( source != NULL )
 	      {
@@ -779,22 +789,22 @@
         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: programs/winedbg/module.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/module.c,v
retrieving revision 1.2
diff -u -u -r1.2 module.c
--- programs/winedbg/module.c	30 Jan 2003 00:24:18 -0000	1.2
+++ programs/winedbg/module.c	1 Feb 2003 10:27:11 -0000
@@ -246,7 +246,7 @@
     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 @@
     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: programs/winedbg/source.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/source.c,v
retrieving revision 1.1
diff -u -u -r1.1 source.c
--- programs/winedbg/source.c	13 Sep 2002 17:54:28 -0000	1.1
+++ programs/winedbg/source.c	1 Feb 2003 10:29:20 -0000
@@ -215,7 +215,7 @@
                     /*
                      * 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] != '/' )
Index: programs/winedbg/winedbg.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/winedbg.c,v
retrieving revision 1.4
diff -u -u -r1.4 winedbg.c
--- programs/winedbg/winedbg.c	9 Jan 2003 06:00:09 -0000	1.4
+++ programs/winedbg/winedbg.c	1 Feb 2003 10:30:04 -0000
@@ -262,7 +262,7 @@
     t->exec_mode = EXEC_CONT;
     t->exec_count = 0;
 
-    sprintf(t->name, "%08lx", tid);
+    snprintf(t->name, sizeof(t->name), "%08lx", tid);
 
     p->num_threads++;
     t->next = p->threads;

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux