#! /bin/sh /usr/share/dpatch/dpatch-run
## 042_htdigest_CAN-2005-1344 by Adam Conrad <adconrad@0c3.net>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Fix buffer overflow in htdigest.

@DPATCH@
--- apache2/support/htdigest.c.orig	2005-05-05 02:54:31.000000000 -0600
+++ apache2/support/htdigest.c	2005-05-05 02:59:05.000000000 -0600
@@ -222,9 +222,11 @@
                     apr_strerror(rv, errmsg, sizeof errmsg));
             exit(1);
         }
+	apr_cpystrn(user, argv[4], sizeof(user));
+	apr_cpystrn(realm, argv[3], sizeof(realm));
         apr_file_printf(errfile, "Adding password for %s in realm %s.\n",
-                    argv[4], argv[3]);
-        add_password(argv[4], argv[3], f);
+                    user, realm);
+        add_password(user, realm, f);
         apr_file_close(f);
         exit(0);
     }
