patch-crypt_c 1.0 KB

1234567891011121314151617181920212223242526272829
  1. $OpenBSD: patch-crypt_c,v 1.1 2017/03/23 17:26:17 bluhm Exp $
  2. Fix CVE-2015-7696: upstream fix for heap overflow
  3. https://bugs.debian.org/802162
  4. https://bugzilla.redhat.com/show_bug.cgi?id=1260944
  5. https://bugzilla.redhat.com/attachment.cgi?id=1073002
  6. --- crypt.c.orig Fri Jan 5 16:47:36 2007
  7. +++ crypt.c Tue Mar 21 16:10:27 2017
  8. @@ -465,7 +465,17 @@ int decrypt(__G__ passwrd)
  9. GLOBAL(pInfo->encrypted) = FALSE;
  10. defer_leftover_input(__G);
  11. for (n = 0; n < RAND_HEAD_LEN; n++) {
  12. - b = NEXTBYTE;
  13. + /* 2012-11-23 SMS. (OUSPG report.)
  14. + * Quit early if compressed size < HEAD_LEN. The resulting
  15. + * error message ("unable to get password") could be improved,
  16. + * but it's better than trying to read nonexistent data, and
  17. + * then continuing with a negative G.csize. (See
  18. + * fileio.c:readbyte()).
  19. + */
  20. + if ((b = NEXTBYTE) == (ush)EOF)
  21. + {
  22. + return PK_ERR;
  23. + }
  24. h[n] = (uch)b;
  25. Trace((stdout, " (%02x)", h[n]));
  26. }