nextbyte-overflow.patch 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. From: Petr Stodulka <pstodulk@redhat.com>
  2. Date: Mon, 14 Sep 2015 18:23:17 +0200
  3. Subject: Upstream fix for heap overflow
  4. Bug-Debian: https://bugs.debian.org/802162
  5. Bug-RedHat: https://bugzilla.redhat.com/show_bug.cgi?id=1260944
  6. Origin: https://bugzilla.redhat.com/attachment.cgi?id=1073002
  7. Forwarded: yes
  8. ---
  9. crypt.c | 12 +++++++++++-
  10. 1 file changed, 11 insertions(+), 1 deletion(-)
  11. --- a/crypt.c
  12. +++ b/crypt.c
  13. @@ -465,7 +465,17 @@
  14. GLOBAL(pInfo->encrypted) = FALSE;
  15. defer_leftover_input(__G);
  16. for (n = 0; n < RAND_HEAD_LEN; n++) {
  17. - b = NEXTBYTE;
  18. + /* 2012-11-23 SMS. (OUSPG report.)
  19. + * Quit early if compressed size < HEAD_LEN. The resulting
  20. + * error message ("unable to get password") could be improved,
  21. + * but it's better than trying to read nonexistent data, and
  22. + * then continuing with a negative G.csize. (See
  23. + * fileio.c:readbyte()).
  24. + */
  25. + if ((b = NEXTBYTE) == (ush)EOF)
  26. + {
  27. + return PK_ERR;
  28. + }
  29. h[n] = (uch)b;
  30. Trace((stdout, " (%02x)", h[n]));
  31. }