File ntping.dif of Package scotty
--- tnm/ntping/ntping.c
+++ tnm/ntping/ntping.c
@@ -160,9 +160,9 @@
#include <tcl.h>
static Tcl_Interp *ntping_interp;
#define printf0(s) { Tcl_AppendResult(ntping_interp, s, NULL); }
-#define printf1(f,a) { char tmp [1024]; sprintf (tmp, f, a); \
+#define printf1(f,a) { char tmp [1024]; snprintf (tmp, sizeof(tmp), f, a); \
Tcl_AppendResult(ntping_interp, tmp, NULL); }
-#define printf2(f,a,b) { char tmp [1024]; sprintf (tmp, f, a, b); \
+#define printf2(f,a,b) { char tmp [1024]; snprintf (tmp, sizeof(tmp), f, a, b); \
Tcl_AppendResult(ntping_interp, tmp, NULL); }
#else
#define printf0 printf
@@ -1855,7 +1855,8 @@
return 1;
/* back to normal rights: */
- setuid (getuid ());
+ if(setuid (getuid ()) < 0)
+ return 2;
if (cmd)
/* work for the command line: */