706520a9d2
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
36 lines
1.0 KiB
Diff
36 lines
1.0 KiB
Diff
From 20c56beb3307b0ac07af0edbbbe49ec65819f559 Mon Sep 17 00:00:00 2001
|
|
From: Giuseppe Scrivano <gscrivan@redhat.com>
|
|
Date: Tue, 29 Sep 2020 16:52:02 +0200
|
|
Subject: [PATCH] exec: check read bytes from sync
|
|
|
|
when reading from the exec sync pipe, make sure it reads exactly one
|
|
byte otherwise return an error.
|
|
|
|
Closes: https://github.com/containers/crun/issues/511
|
|
|
|
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
|
|
---
|
|
src/libcrun/container.c | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/libcrun/container.c b/src/libcrun/container.c
|
|
index 927986a..0308992 100644
|
|
--- a/src/libcrun/container.c
|
|
+++ b/src/libcrun/container.c
|
|
@@ -2595,10 +2595,10 @@ libcrun_container_exec (libcrun_context_t *context, const char *id, runtime_spec
|
|
}
|
|
}
|
|
|
|
- TEMP_FAILURE_RETRY (read (pipefd0, &b, sizeof (b)));
|
|
+ ret = TEMP_FAILURE_RETRY (read (pipefd0, &b, sizeof (b)));
|
|
TEMP_FAILURE_RETRY (close (pipefd0));
|
|
pipefd0 = -1;
|
|
- if (b != '0')
|
|
+ if (ret != 1 || b != '0')
|
|
ret = -1;
|
|
else
|
|
{
|
|
--
|
|
2.26.2
|
|
|