Commit 7f98abc730 for openssl.org

commit 7f98abc730f7b684e800caad26bd6824be4435ad
Author: Ahmed Rabea <Ahmed.Rabea2100@gmail.com>
Date:   Thu May 21 16:24:11 2026 +0300

    crypto/dso/dso_win32.c: fix win32_joiner buffer sizing for dir-only paths

    win32_joiner() always emits a trailing '\' when file_split->dir
    is present, even if file_split->file is NULL. The previous length
    calculation only reserved that byte when file_split->file was also
    non-NULL, which could cause a one-byte overflow.

    Resolves: https://github.com/openssl/openssl/issues/31260
    Fixes: cbecb3ac3763 "There's an ongoing project to bring some kind of path selection mechanism to the ENGINE framework.  This means there there are going to be new functionality for the DSO part, and ultimately some way of merging two file specifications together.
    CLA: trivial

    Reviewed-by: Neil Horman <nhorman@openssl.org>
    Reviewed-by: Saša NedvÄ›dický <sashan@openssl.org>
    Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
    MergeDate: Tue May 26 09:36:02 2026
    (Merged from https://github.com/openssl/openssl/pull/31266)

diff --git a/crypto/dso/dso_win32.c b/crypto/dso/dso_win32.c
index 2a9014d1e8..78cc649324 100644
--- a/crypto/dso/dso_win32.c
+++ b/crypto/dso/dso_win32.c
@@ -321,7 +321,7 @@ static char *win32_joiner(DSO *dso, const struct file_st *file_split)
         len++; /* 1 for ending \ */
     }
     len += file_split->dirlen;
-    if (file_split->dir && file_split->file) {
+    if (file_split->dir) {
         len++; /* 1 for ending \ */
     }
     len += file_split->filelen;