]> www.average.org Git - pam_pcsc_cr.git/commitdiff
Increase buffer size for base64 encoder
authorEugene Crosser <crosser@average.org>
Thu, 23 Apr 2020 19:57:50 +0000 (21:57 +0200)
committerEugene Crosser <crosser@average.org>
Thu, 23 Apr 2020 19:57:50 +0000 (21:57 +0200)
(borrowed) base64 encoder apparently uses one byte more than the formula
for base64 encoded size shows. This smashed a local variable, which was
not used afterwards and did not cause problems, but triggered stack
smash detector if the caller was compiled to use it.

authfile.c
configure.ac

index 93157a4e1a9a8460c46a6fc609e1b18a62fd5885..89d32438383d935b08fa85ee18c784a740c55695 100644 (file)
@@ -190,7 +190,7 @@ struct _auth_obj authfile(const char *userid, const char *password,
 
        oldmask = umask(077);
        if ((fp = fopen(nfn, "w"))) {
-               int bsize = ((ao.datasize-1)/3+1)*4+1;
+               int bsize = ((ao.datasize-1)/3+1)*4+2; /* why +2 ??? */
                char *b64 = alloca(bsize);
 
                if (b64_encode(ao.data, ao.datasize, b64, &bsize)) {
index 8adf9404d643a1b0b55a2af197e7d67e26714411..2ac5dd93a5d900d3e03d834fcb8fb0814c8c76d5 100644 (file)
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script.
 
-AC_INIT([pam_pcsc_cr], 0.9.5)
+AC_INIT([pam_pcsc_cr], 0.9.6)
 AC_CONFIG_SRCDIR([pam_pcsc_cr.c])
 AC_CONFIG_MACRO_DIR([m4])
 AM_INIT_AUTOMAKE
@@ -11,6 +11,7 @@ AC_PROG_CC
 if test "X$CC" = "Xgcc"; then
   CFLAGS="$CFLAGS -Wall"
 fi
+dnl -fstack-protector-all -fsanitize=address
 
 AC_PROG_MAKE_SET
 AC_SUBST(PROGS)dnl