mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-18 03:41:52 +00:00
fix console overwrite any file
Prevent to specify a file not belonging to us as the output for the console Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
This commit is contained in:
parent
28f602ff47
commit
00dbc43e30
@ -30,10 +30,10 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
|
|
||||||
#include <lxc/log.h>
|
#include "log.h"
|
||||||
#include <lxc/conf.h>
|
#include "conf.h"
|
||||||
#include <lxc/start.h> /* for struct lxc_handler */
|
#include "start.h" /* for struct lxc_handler */
|
||||||
|
#include "caps.h"
|
||||||
#include "commands.h"
|
#include "commands.h"
|
||||||
#include "mainloop.h"
|
#include "mainloop.h"
|
||||||
#include "af_unix.h"
|
#include "af_unix.h"
|
||||||
@ -192,7 +192,8 @@ int lxc_create_console(struct lxc_conf *conf)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = open(console->path, O_CLOEXEC | O_RDWR | O_CREAT | O_APPEND, 0600);
|
fd = lxc_unpriv(open(console->path, O_CLOEXEC | O_RDWR | O_CREAT |
|
||||||
|
O_APPEND, 0600));
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
SYSERROR("failed to open '%s'", console->path);
|
SYSERROR("failed to open '%s'", console->path);
|
||||||
goto err;
|
goto err;
|
||||||
|
Loading…
Reference in New Issue
Block a user