patch-extras_th_htpasswd_c 727 B

123456789101112131415161718192021
  1. $OpenBSD: patch-extras_th_htpasswd_c,v 1.1 2014/05/06 09:00:37 jasper Exp $
  2. A local attacker with the ability to alter .htpasswd files could
  3. cause a Denial of Service in thttpd by specially-crafting them.
  4. CVE-2012-5640
  5. --- extras/th_htpasswd.c.orig Thu May 1 10:49:44 2014
  6. +++ extras/th_htpasswd.c Thu May 1 10:50:16 2014
  7. @@ -140,7 +140,10 @@ add_password( char* user, FILE* f )
  8. (void) srandom( (int) time( (time_t*) 0 ) );
  9. to64( &salt[0], random(), 2 );
  10. cpw = crypt( pw, salt );
  11. - (void) fprintf( f, "%s:%s\n", user, cpw );
  12. + if (cpw)
  13. + (void) fprintf( f, "%s:%s\n", user, cpw );
  14. + else
  15. + (void) fprintf( stderr, "crypt() returned NULL, sorry\n" );
  16. }
  17. static void usage(void) {