Skip to contentSkip to conversation

rpc-pipefs-generator: allocate enough space for pipefs-directory buffer

PATCH In review Steve Dickson 1 participant 2 messages Jul 21, 2022 – Jul 22, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rpc-pipefs-generator: allocate enough space for pipefs-directory buffer

Commit 7f8463fe fixed a warning but introduce
a regression by not allocating enough space
for the pipefs-directory buffer when it is
not the default.

---
 systemd/rpc-pipefs-generator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
systemd/rpc-pipefs-generator.c +1 -1
index 7b2bb4f7..3aaeaeaf 100644
@@ -28,7 +28,7 @@ static int generate_mount_unit(const char *pipefs_path, const char *pipefs_unit,
 {
 	char	*path;
 	FILE	*f;
-	size_t size = (strlen(dirname) + 1 + strlen(pipefs_unit));
+	size_t size = (strlen(dirname) + 1 + strlen(pipefs_unit) + 1);
 
 	path = malloc(size);
 	if (!path)
Signature · 1 line
2.36.1
#1 lore raw
Quoted 7 lines · Steve Dickson

Commit 7f8463fe fixed a warning but introduce
a regression by not allocating enough space
for the pipefs-directory buffer when it is
not the default.

Committed....

steved.

Quoted 17 lines
---
  systemd/rpc-pipefs-generator.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
systemd/rpc-pipefs-generator.c +1 -1
index 7b2bb4f7..3aaeaeaf 100644
@@ -28,7 +28,7 @@ static int generate_mount_unit(const char *pipefs_path, const char *pipefs_unit,
  {
  	char	*path;
  	FILE	*f;
-	size_t size = (strlen(dirname) + 1 + strlen(pipefs_unit));
+	size_t size = (strlen(dirname) + 1 + strlen(pipefs_unit) + 1);
 
  	path = malloc(size);
  	if (!path)