From b38eae99f5dd7c796ade7865fe8093475715a21f Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Tue, 2 May 2023 22:37:17 +0200
Subject: [PATCH] shared: reject empty attachment path

(cherry picked from commit 740831076cfcf2f73f3063fbb040c1ea593dfe6c)
(cherry picked from commit ce096b0212aac52fad658aaec5ff53b0d6eb18ad)
(cherry picked from commit f76199e779444590c50f7df60b8c5b235b9447b0)

Conflict:code context adaptation
Reference:https://github.com/systemd/systemd-stable/commit/b38eae99f5dd7c796ade7865fe8093475715a21f
---
 src/shared/bpf-program.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/shared/bpf-program.c b/src/shared/bpf-program.c
index 31fa4448b0..57a009a965 100644
--- a/src/shared/bpf-program.c
+++ b/src/shared/bpf-program.c
@@ -452,6 +452,9 @@ int bpf_program_deserialize_attachment(const char *v, FDSet *fds, BPFProgram **b
                 return at;
 
         /* The rest is the path */
+        if (isempty(v))
+                return -EINVAL;
+
         r = cunescape(v, 0, &unescaped);
         if (r < 0)
                 return r;
-- 
2.33.0

