> > misc/brltty
> > sysutils/cdrtools
> > x11/fvwm2

I have committed the three above.

> > security/gnupg

This one is really horrible. The part of the diff involving tty_fprintf
needed some fixing.  The agent/protect.c looks correct to me. A careful
review by more than one person seems necessary.

Index: Makefile
===================================================================
RCS file: /cvs/ports/security/gnupg/Makefile,v
retrieving revision 1.121
diff -u -p -r1.121 Makefile
--- Makefile    30 Aug 2021 17:04:45 -0000      1.121
+++ Makefile    19 Sep 2021 20:23:50 -0000
@@ -4,6 +4,7 @@ COMMENT =       GNU privacy guard - a free PGP
 
 DISTNAME =     gnupg-2.2.30
 CATEGORIES =   security
+REVISION =     0
 
 MASTER_SITES = ${MASTER_SITE_GNUPG:=gnupg/}
 
Index: patches/patch-agent_protect_c
===================================================================
RCS file: patches/patch-agent_protect_c
diff -N patches/patch-agent_protect_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-agent_protect_c       19 Sep 2021 21:13:46 -0000
@@ -0,0 +1,72 @@
+$OpenBSD$
+
+Index: agent/protect.c
+--- agent/protect.c.orig
++++ agent/protect.c
+@@ -563,24 +563,59 @@ do_encryption (const unsigned char *hashbegin, size_t 
+      and dummy values as placeholders.  */
+   {
+     char countbuf[35];
++    char *p1 = NULL, *p2 = NULL, *p3 = NULL;
+ 
+-    snprintf (countbuf, sizeof countbuf, "%lu",
+-          s2k_count ? s2k_count : get_standard_s2k_count ());
++#define FMT1  "(9:protected%d:%s((4:sha18:"
++#define FMT2  "_8bytes_%u:%s)%d:"
++#define FMT3  "%*s)%d:"
++
++    p1 = xtryasprintf
++      (FMT1,
++       (int)strlen (modestr), modestr);
++    if (!p1)
++      goto fail;
++    saltpos = strlen(p1);
++
++    p2 = xtryasprintf
++      (FMT1 FMT2,
++       (int)strlen (modestr), modestr,
++       (unsigned int)strlen (countbuf), countbuf,
++       use_ocb? 12 : blklen);
++    if (!p2)
++      goto fail;
++    ivpos = strlen(p2);
++
++    p3 = xtryasprintf
++      (FMT1 FMT2 FMT3,
++       (int)strlen (modestr), modestr,
++       (unsigned int)strlen (countbuf), countbuf,
++       use_ocb? 12 : blklen, use_ocb? 12 : blklen, "",
++       enclen);
++    if (!p3)
++      goto fail;
++    encpos = strlen(p3);
++
+     p = xtryasprintf
+-      ("(9:protected%d:%s((4:sha18:%n_8bytes_%u:%s)%d:%n%*s)%d:%n%*s)",
++      (FMT1 FMT2 FMT3 "%*s)",
+        (int)strlen (modestr), modestr,
+-       &saltpos,
+        (unsigned int)strlen (countbuf), countbuf,
+-       use_ocb? 12 : blklen, &ivpos, use_ocb? 12 : blklen, "",
+-       enclen, &encpos, enclen, "");
++       use_ocb? 12 : blklen, use_ocb? 12 : blklen, "",
++       enclen, enclen, "");
++
+     if (!p)
+       {
++fail:
++        free(p1);
++        free(p2);
++        free(p3);
+         gpg_error_t tmperr = out_of_core ();
+         xfree (iv);
+         xfree (outbuf);
+         return tmperr;
+       }
+-
++    free(p1);
++    free(p2);
++    free(p3);
+   }
+   *resultlen = strlen (p);
+   *result = (unsigned char*)p;
Index: patches/patch-common_ttyio_c
===================================================================
RCS file: patches/patch-common_ttyio_c
diff -N patches/patch-common_ttyio_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-common_ttyio_c        19 Sep 2021 20:35:51 -0000
@@ -0,0 +1,55 @@
+$OpenBSD$
+
+Index: common/ttyio.c
+--- common/ttyio.c.orig
++++ common/ttyio.c
+@@ -293,21 +293,22 @@ tty_printf (const char *fmt, ... )
+ 
+ /* Same as tty_printf but if FP is not NULL, behave like a regular
+    fprintf. */
+-void
++int
+ tty_fprintf (estream_t fp, const char *fmt, ... )
+ {
+   va_list arg_ptr;
++  int ret;
+ 
+   if (fp)
+     {
+       va_start (arg_ptr, fmt) ;
+-      es_vfprintf (fp, fmt, arg_ptr );
++      ret = es_vfprintf (fp, fmt, arg_ptr );
+       va_end (arg_ptr);
+-      return;
++      return ret;
+     }
+ 
+   if (no_terminal)
+-    return;
++    return 0;
+ 
+   if (!initialized)
+     init_ttyfp ();
+@@ -318,18 +319,20 @@ tty_fprintf (estream_t fp, const char *fmt, ... )
+   {
+     char *buf = NULL;
+ 
+-    vasprintf (&buf, fmt, arg_ptr);
++    ret = vasprintf (&buf, fmt, arg_ptr);
+     if (!buf)
+       log_bug ("vasprintf() failed\n");
+     w32_write_console (buf);
+     xfree (buf);
+   }
+ #else /* Unix */
+-  last_prompt_len += vfprintf(ttyfp,fmt,arg_ptr) ;
++  ret = vfprintf(ttyfp,fmt,arg_ptr) ;
++  last_prompt_len += ret ;
+   fflush(ttyfp);
+ #endif /* Unix */
+ 
+   va_end(arg_ptr);
++  return ret;
+ }
+ 
+ 
Index: patches/patch-common_ttyio_h
===================================================================
RCS file: patches/patch-common_ttyio_h
diff -N patches/patch-common_ttyio_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-common_ttyio_h        19 Sep 2021 20:34:40 -0000
@@ -0,0 +1,21 @@
+$OpenBSD$
+
+Index: common/ttyio.h
+--- common/ttyio.h.orig
++++ common/ttyio.h
+@@ -38,13 +38,13 @@ int tty_batchmode (int onoff);
+ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 )
+ void tty_printf (const char *fmt, ... )
+                  __attribute__ ((format (printf,1,2)));
+-void tty_fprintf (estream_t fp, const char *fmt, ... )
++int tty_fprintf (estream_t fp, const char *fmt, ... )
+                  __attribute__ ((format (printf,2,3)));
+ char *tty_getf (const char *promptfmt, ... )
+                  __attribute__ ((format (printf,1,2)));
+ #else
+ void tty_printf (const char *fmt, ... );
+-void tty_fprintf (estream_t fp, const char *fmt, ... );
++int tty_fprintf (estream_t fp, const char *fmt, ... );
+ char *tty_getf (const char *promptfmt, ... );
+ #endif
+ void tty_print_utf8_string (const unsigned char *p, size_t n);
Index: patches/patch-g10_keylist_c
===================================================================
RCS file: patches/patch-g10_keylist_c
diff -N patches/patch-g10_keylist_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-g10_keylist_c 19 Sep 2021 20:23:37 -0000
@@ -0,0 +1,20 @@
+$OpenBSD$
+
+Index: g10/keylist.c
+--- g10/keylist.c.orig
++++ g10/keylist.c
+@@ -255,12 +255,11 @@ print_card_key_info (estream_t fp, kbnode_t keyblock)
+           else
+             s2k_char = '#';  /* Key not found.  */
+ 
+-          tty_fprintf (fp, "%s%c  %s/%s  %n",
++          indent = tty_fprintf (fp, "%s%c  %s/%s  ",
+                        node->pkt->pkttype == PKT_PUBLIC_KEY ? "sec" : "ssb",
+                        s2k_char,
+                        pubkey_string (pk, pkstrbuf, sizeof pkstrbuf),
+-                       keystr_from_pk (pk),
+-                       &indent);
++                       keystr_from_pk (pk));
+           tty_fprintf (fp, _("created: %s"), datestr_from_pk (pk));
+           tty_fprintf (fp, "  ");
+           tty_fprintf (fp, _("expires: %s"), expirestr_from_pk (pk));

Reply via email to