propolice and syslog-ng

Robert Connolly robert at linuxfromscratch.org
Wed Sep 29 18:43:24 PDT 2004


I have another idea..

 if (i < sizeof(__guard) / 4) {
  int fd;
  size_t size;
  /* Sysctl Erandom doesn't work? Try /dev/urandom */
  fd = open ("/dev/urandom", O_RDONLY);
  if (fd != -1) {
   size = read (fd, (char*)&__guard, sizeof(__guard));
   close (fd) ;
   if (size == sizeof(__guard))
   return;
  } else {
   /* If above was unsuccessful, use the "terminator canary". */
   ((unsigned char *)__guard)[0] = 0;
   ((unsigned char *)__guard)[1] = 0;
   ((unsigned char *)__guard)[2] = '\n';
   ((unsigned char *)__guard)[3] = 255;
   }

I think using this else is better then what's in the previous post attachment.



More information about the hlfs-dev mailing list