Skip to content

Conversation

@kojo1
Copy link
Contributor

@kojo1 kojo1 commented Jan 29, 2026

When both `new_certs_dir` (from config file) and `-out` option are
specified in the `ca` command, the output paths were incorrectly
concatenated.

Bug example:

  • Config: `new_certs_dir = /tmp/certs`
  • Command: `wolfssl ca -config ca.conf -out /tmp/output/signed.pem ...`
  • Result: `/tmp/certs/tmp/output/signed.pem` (wrong)
  • Expected: `/tmp/output/signed.pem`

Root Cause

In `wolfCLU_CertSignAppendOut()` (src/x509/clu_x509_sign.c), when appending
the `-out` path to `new_certs_dir`:

  1. Absolute paths in `-out` were not detected and should override
    `new_certs_dir`
  2. Path separator `/` was missing when concatenating directory and filename

Fix

  • If `-out` is an absolute path (starts with `/`), use it directly
  • For relative paths, add path separator between directory and filename when
    needed

Test Plan

  • Build passes
  • All 22 existing tests pass
  • Added new test cases in x509-ca-test.sh:
    • Absolute `-out` path overrides `new_certs_dir`
    • Relative `-out` path appends to `new_certs_dir` with separator"

kojo1 and others added 2 commits January 29, 2026 11:31
When both new_certs_dir (from config) and -out option are specified,
the paths were incorrectly concatenated without considering:
1. Absolute paths in -out should override new_certs_dir
2. Path separator was missing between directory and filename

This fix:
- Uses -out path directly if it is an absolute path
- Adds path separator when appending relative paths

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Tests the fix for path concatenation bug:
- Absolute -out path overrides new_certs_dir
- Relative -out path is appended to new_certs_dir with separator

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@kojo1 kojo1 requested a review from wolfSSL-Bot January 29, 2026 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant