mirror of
https://github.com/troglobit/finit.git
synced 2026-10-29 12:40:44 +00:00
initctl: ensure the returned plugin buffer data is terminated
Found by Coverity Scan Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
f4d8ecfb5b
commit
67e80ea989
1 file changed
+3
-2
+3
-2
@@ -717,7 +717,7 @@ static int plugins_list(char *arg)
|
|||||||
.magic = INIT_MAGIC,
|
.magic = INIT_MAGIC,
|
||||||
.cmd = INIT_CMD_GET_PLUGINS,
|
.cmd = INIT_CMD_GET_PLUGINS,
|
||||||
};
|
};
|
||||||
char buf[sizeof(rq.data)];
|
char buf[sizeof(rq.data) + 1];
|
||||||
char *ptr;
|
char *ptr;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@@ -728,7 +728,8 @@ static int plugins_list(char *arg)
|
|||||||
else
|
else
|
||||||
ERRX(69, "No such command");
|
ERRX(69, "No such command");
|
||||||
}
|
}
|
||||||
memcpy(buf, rq.data, sizeof(buf));
|
memcpy(buf, rq.data, sizeof(buf) - 1);
|
||||||
|
buf[sizeof(rq.data)] = 0;
|
||||||
|
|
||||||
if (heading)
|
if (heading)
|
||||||
print_header("%-18s %s", "PLUGIN", "DEPENDENCIES");
|
print_header("%-18s %s", "PLUGIN", "DEPENDENCIES");
|
||||||
|
|||||||
Reference in new issue
Block a user