x11-xserver-utils/debian/patches/14_SECURITY_setuid.diff

33 lines
1.0 KiB
Diff

Index: xbase-clients/xload/xload.c
===================================================================
--- xbase-clients.orig/xload/xload.c 2006-06-30 01:08:01.000000000 -0400
+++ xbase-clients/xload/xload.c 2006-06-30 01:08:51.000000000 -0400
@@ -35,6 +35,7 @@
*/
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -162,8 +163,17 @@
/* For security reasons, we reset our uid/gid after doing the necessary
system initialization and before calling any X routines. */
InitLoadPoint();
- setgid(getgid()); /* reset gid first while still (maybe) root */
- setuid(getuid());
+ /* reset gid first while still (maybe) root */
+ if (setgid(getgid()) == -1) {
+ fprintf(stderr, "%s: setgid failed: %s\n",
+ ProgramName, strerror(errno));
+ exit(1);
+ }
+ if (setuid(getuid()) == -1) {
+ fprintf(stderr, "%s: setuid failed: %s\n",
+ ProgramName, strerror(errno));
+ exit(1);
+ }
XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL);