]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: fix sshbuf_dtourlb64() to not choke on empty buffers;
authordjm@openbsd.org <djm@openbsd.org>
Thu, 4 Sep 2025 00:32:31 +0000 (00:32 +0000)
committerDamien Miller <djm@mindrot.org>
Thu, 4 Sep 2025 03:06:18 +0000 (13:06 +1000)
previously it incorrectly returned an error in this situation; ok deraadt

OpenBSD-Commit-ID: e62773d6e8cb95a19aab54f0af0edbcd47b345c0

sshbuf-misc.c

index bc92866db60a9cafa75c7ba29590954c80be423d..431809d906df0da3699e648d3774e8113cea7449 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: sshbuf-misc.c,v 1.21 2025/07/24 05:44:55 djm Exp $    */
+/*     $OpenBSD: sshbuf-misc.c,v 1.22 2025/09/04 00:32:31 djm Exp $    */
 /*
  * Copyright (c) 2011 Damien Miller
  *
@@ -212,6 +212,9 @@ sshbuf_dtourlb64(const struct sshbuf *d, struct sshbuf *b64, int wrap)
        struct sshbuf *b = NULL;
        size_t i, l;
 
+       if (sshbuf_len(d) == 0)
+               return 0;
+
        if ((b = sshbuf_new()) == NULL)
                return SSH_ERR_ALLOC_FAIL;
        /* Encode using regular base64; we'll transform it once done */