Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

vzctl: do not allow too high CTID

Commit 8785cbd already introduced the check for too high CTID.
Some kernels also use a few values close to INT_MAX for internal
purposes, so such CTs can not be started.

Add CTID_MAX and fix the check for CTID to use it.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
  • Loading branch information...
commit af42bbd1ec74e5f2504066960e41ba39ce8867a5 1 parent 282d6f8
Kirill Kolyshkin kolyshkin authored
Showing with 6 additions and 3 deletions.
  1. +4 −1 include/types.h
  2. +2 −2 src/vzctl.c
5 include/types.h
View
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2009, Parallels, Inc. All rights reserved.
+ * Copyright (C) 2000-2011, Parallels, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -92,4 +92,7 @@ typedef enum {
typedef int (* execFn)(void *data);
+/* Some kernels use a few IDs close to INT_MAX (2147483647) */
+#define VEID_MAX 2147483644
+
#endif
4 src/vzctl.c
View
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2010, Parallels, Inc. All rights reserved.
+ * Copyright (C) 2000-2011, Parallels, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -234,7 +234,7 @@ int main(int argc, char *argv[], char *envp[])
if (parse_int(argv[2], &veid)) {
name = strdup(argv[2]);
veid = get_veid_by_name(name);
- if (veid < 0 || veid == INT_MAX) {
+ if (veid < 0 || veid > VEID_MAX) {
fprintf(stderr, "Bad CT ID %s\n", argv[2]);
ret = VZ_INVALID_PARAMETER_VALUE;
goto error;
Please sign in to comment.
Something went wrong with that request. Please try again.