Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 65892 | Differences between
and this patch

Collapse All | Expand All

(-)ssp.c.orig (-21 / +21 lines)
Lines 76-88 Link Here
76
  {
76
  {
77
    int fd;
77
    int fd;
78
#ifdef HAVE_DEV_ERANDOM
78
#ifdef HAVE_DEV_ERANDOM
79
    if ((fd = open ("/dev/erandom", O_RDONLY)) == (-1))
79
    if ((fd = __open ("/dev/erandom", O_RDONLY)) == (-1))
80
#endif
80
#endif
81
      fd = open ("/dev/urandom", O_RDONLY);
81
      fd = __open ("/dev/urandom", O_RDONLY);
82
    if (fd != (-1))
82
    if (fd != (-1))
83
      {
83
      {
84
	size = read (fd, (char *) &__guard, sizeof (__guard));
84
	size = __read (fd, (char *) &__guard, sizeof (__guard));
85
	close (fd);
85
	__close (fd);
86
	if (size == sizeof (__guard))
86
	if (size == sizeof (__guard))
87
	  return;
87
	  return;
88
      }
88
      }
Lines 97-103 Link Here
97
     * terminator canary */
97
     * terminator canary */
98
    struct timeval tv;
98
    struct timeval tv;
99
99
100
    gettimeofday (&tv, NULL);
100
    __gettimeofday (&tv, NULL);
101
    __guard ^= tv.tv_usec ^ tv.tv_sec;
101
    __guard ^= tv.tv_usec ^ tv.tv_sec;
102
  }
102
  }
103
}
103
}
Lines 118-169 Link Here
118
#endif
118
#endif
119
119
120
  sigset_t mask;
120
  sigset_t mask;
121
  sigfillset (&mask);
121
  __sigfillset (&mask);
122
  
122
  
123
 sigdelset(&mask, SIGABRT); */ /* Block all signal handlers */
123
 __sigdelset(&mask, SIGABRT); */ /* Block all signal handlers */
124
 sigprocmask(SIG_BLOCK, &mask, NULL); */ /* except SIGABRT */
124
 __sigprocmask(SIG_BLOCK, &mask, NULL); */ /* except SIGABRT */
125
125
126
// sigdelset(&mask, SIGSEGV);  /* Block all signal handlers */
126
// sigdelset(&mask, SIGSEGV);  /* Block all signal handlers */
127
// sigprocmask(SIG_BLOCK, &mask, NULL); /* except SIGSEGV */
127
// sigprocmask(SIG_BLOCK, &mask, NULL); /* except SIGSEGV */
128
128
129
  bufsz = sizeof (buf);
129
  bufsz = sizeof (buf);
130
  strcpy (buf, "<2>");
130
  __strcpy (buf, "<2>");
131
  len = 3;
131
  len = 3;
132
132
133
  strncat (buf, __progname, sizeof (buf) - 4);
133
  __strncat (buf, __progname, sizeof (buf) - 4);
134
  len = strlen (buf);
134
  len = __strlen (buf);
135
135
136
  if (bufsz > len)
136
  if (bufsz > len)
137
    {
137
    {
138
      strncat (buf, message, bufsz - len - 1);
138
      __strncat (buf, message, bufsz - len - 1);
139
      len = strlen (buf);
139
      len = __strlen (buf);
140
    }
140
    }
141
  if (bufsz > len)
141
  if (bufsz > len)
142
    {
142
    {
143
      strncat (buf, func, bufsz - len - 1);
143
      __strncat (buf, func, bufsz - len - 1);
144
      len = strlen (buf);
144
      len = __strlen (buf);
145
    }
145
    }
146
146
147
  /* print error message */
147
  /* print error message */
148
  write (STDERR_FILENO, buf + 3, len - 3);
148
  write (STDERR_FILENO, buf + 3, len - 3);
149
  write (STDERR_FILENO, "()\n", 3);
149
  write (STDERR_FILENO, "()\n", 3);
150
#ifndef __dietlibc__
150
#ifndef __dietlibc__
151
  if ((log = socket (AF_UNIX, SOCK_DGRAM, 0)) != -1)
151
  if ((log = __socket (AF_UNIX, SOCK_DGRAM, 0)) != -1)
152
    {
152
    {
153
      /* Send "found" message to the "/dev/log" path */
153
      /* Send "found" message to the "/dev/log" path */
154
      sock.sun_family = AF_UNIX;
154
      sock.sun_family = AF_UNIX;
155
      (void) strncpy (sock.sun_path, _PATH_LOG, sizeof (sock.sun_path) - 1);
155
      (void) __strncpy (sock.sun_path, _PATH_LOG, sizeof (sock.sun_path) - 1);
156
      sock.sun_path[sizeof (sock.sun_path) - 1] = '\0';
156
      sock.sun_path[sizeof (sock.sun_path) - 1] = '\0';
157
      sendto (log, buf, len, 0, (struct sockaddr *) &sock, sizeof (sock));
157
      __sendto (log, buf, len, 0, (struct sockaddr *) &sock, sizeof (sock));
158
    }
158
    }
159
#endif
159
#endif
160
  /* Make sure the default handler is associated with the our signal handler */
160
  /* Make sure the default handler is associated with the our signal handler */
161
161
162
  memset (&sa, 0, sizeof (struct sigaction));
162
  memset (&sa, 0, sizeof (struct sigaction));
163
  sigfillset (&sa.sa_mask);	/* Block all signals */
163
  __sigfillset (&sa.sa_mask);	/* Block all signals */
164
  sa.sa_flags = 0;
164
  sa.sa_flags = 0;
165
  sa.sa_handler = SIG_DFL;
165
  sa.sa_handler = SIG_DFL;
166
  sigaction (SSP_SIGTYPE, &sa, NULL);
166
  __sigaction (SSP_SIGTYPE, &sa, NULL);
167
  (void) kill (getpid (), SSP_SIGTYPE);
167
  (void) __kill (__getpid (), SSP_SIGTYPE);
168
  _exit (127);
168
  _exit (127);
169
}
169
}

Return to bug 65892