diff mbox series

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

Message ID 20220721191812.60294-1-steved@redhat.com (mailing list archive)
State New, archived
Headers show
Series rpc-pipefs-generator: allocate enough space for pipefs-directory buffer | expand

Commit Message

Steve Dickson July 21, 2022, 7:18 p.m. UTC
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.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2106896
Signed-off-by: Steve Dickson <steved@redhat.com>
---
 systemd/rpc-pipefs-generator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Steve Dickson July 22, 2022, 3:02 p.m. UTC | #1
On 7/21/22 3:18 PM, Steve Dickson wrote:
> 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.
> 
> Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2106896
> Signed-off-by: Steve Dickson <steved@redhat.com>
Committed....

steved.

> ---
>   systemd/rpc-pipefs-generator.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/systemd/rpc-pipefs-generator.c b/systemd/rpc-pipefs-generator.c
> index 7b2bb4f7..3aaeaeaf 100644
> --- a/systemd/rpc-pipefs-generator.c
> +++ b/systemd/rpc-pipefs-generator.c
> @@ -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)
diff mbox series

Patch

diff --git a/systemd/rpc-pipefs-generator.c b/systemd/rpc-pipefs-generator.c
index 7b2bb4f7..3aaeaeaf 100644
--- a/systemd/rpc-pipefs-generator.c
+++ b/systemd/rpc-pipefs-generator.c
@@ -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)