texinfo.patch 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. Security Bugfixes (CVE-2005-3011, CVE-2006-4810)
  2. Index: util/texindex.c
  3. --- util/texindex.c.orig 2004-04-11 19:56:47 +0200
  4. +++ util/texindex.c 2006-11-14 23:39:23 +0100
  5. @@ -390,11 +390,12 @@
  6. maketempname (int count)
  7. {
  8. static char *tempbase = NULL;
  9. + char *tempname;
  10. char tempsuffix[10];
  11. + int fd;
  12. if (!tempbase)
  13. {
  14. - int fd;
  15. tempbase = concat (tempdir, "txidxXXXXXX");
  16. fd = mkstemp (tempbase);
  17. @@ -403,7 +404,12 @@
  18. }
  19. sprintf (tempsuffix, ".%d", count);
  20. - return concat (tempbase, tempsuffix);
  21. + tempname = concat (tempbase, tempsuffix);
  22. + fd = open (tempname, O_CREAT|O_EXCL|O_WRONLY, 0600);
  23. + if (fd == -1)
  24. + pfatal_with_name (tempname);
  25. + close (fd);
  26. + return tempname;
  27. }
  28. @@ -837,7 +843,7 @@
  29. {
  30. buffer = (char *) xrealloc (buffer, linebuffer->size *= 2);
  31. p += buffer - linebuffer->buffer;
  32. - end += buffer - linebuffer->buffer;
  33. + end = buffer + linebuffer->size;
  34. linebuffer->buffer = buffer;
  35. }
  36. if (c < 0 || c == '\n')