git: 6fcafba9b365 - stable/15 - nuageinit: add nil/empty guard to decode_base64()

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Sun, 28 Jun 2026 18:40:21 UTC
The branch stable/15 has been updated by bapt:

URL: https://cgit.FreeBSD.org/src/commit/?id=6fcafba9b365878f9ba37bfb34ca819c8c848cea

commit 6fcafba9b365878f9ba37bfb34ca819c8c848cea
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2026-06-04 18:09:06 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2026-06-28 18:32:24 +0000

    nuageinit: add nil/empty guard to decode_base64()
    
    Return an empty string when input is nil or zero-length instead
    of processing it through the decoding loop.
    
    (cherry picked from commit 57807f389a9e42774d944e256b499f5fd82ff855)
---
 libexec/nuageinit/nuage.lua | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libexec/nuageinit/nuage.lua b/libexec/nuageinit/nuage.lua
index 839cf3588021..4f25e79ccefc 100644
--- a/libexec/nuageinit/nuage.lua
+++ b/libexec/nuageinit/nuage.lua
@@ -20,6 +20,9 @@ local function getlocalbase()
 end
 
 local function decode_base64(input)
+	if input == nil or #input == 0 then
+		return ""
+	end
 	local b = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
 	input = string.gsub(input, '[^'..b..'=]', '')