[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 01/10] tools/xenstore: verify command line parameters better



Add some more verification of command line parameters.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 tools/xenstore/xenstored_core.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index ae1ea29b80..714841d9ca 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2790,7 +2790,7 @@ int main(int argc, char *argv[])
                        no_domain_init = true;
                        break;
                case 'E':
-                       hard_quotas[ACC_NODES].val = strtoul(optarg, NULL, 10);
+                       hard_quotas[ACC_NODES].val = get_optval_int(optarg);
                        break;
                case 'F':
                        pidfile = optarg;
@@ -2808,10 +2808,10 @@ int main(int argc, char *argv[])
                        recovery = false;
                        break;
                case 'S':
-                       hard_quotas[ACC_NODESZ].val = strtoul(optarg, NULL, 10);
+                       hard_quotas[ACC_NODESZ].val = get_optval_int(optarg);
                        break;
                case 't':
-                       hard_quotas[ACC_TRANS].val = strtoul(optarg, NULL, 10);
+                       hard_quotas[ACC_TRANS].val = get_optval_int(optarg);
                        break;
                case 'T':
                        tracefile = optarg;
@@ -2830,14 +2830,13 @@ int main(int argc, char *argv[])
                        verbose = true;
                        break;
                case 'W':
-                       hard_quotas[ACC_WATCH].val = strtoul(optarg, NULL, 10);
+                       hard_quotas[ACC_WATCH].val = get_optval_int(optarg);
                        break;
                case 'A':
-                       hard_quotas[ACC_NPERM].val = strtoul(optarg, NULL, 10);
+                       hard_quotas[ACC_NPERM].val = get_optval_int(optarg);
                        break;
                case 'M':
-                       hard_quotas[ACC_PATHLEN].val =
-                               strtoul(optarg, NULL, 10);
+                       hard_quotas[ACC_PATHLEN].val = get_optval_int(optarg);
                        hard_quotas[ACC_PATHLEN].val =
                                 min((unsigned int)XENSTORE_REL_PATH_MAX,
                                     hard_quotas[ACC_PATHLEN].val);
@@ -2852,13 +2851,13 @@ int main(int argc, char *argv[])
                        set_timeout(optarg);
                        break;
                case 'e':
-                       dom0_event = strtol(optarg, NULL, 10);
+                       dom0_event = get_optval_int(optarg);
                        break;
                case 'm':
-                       dom0_domid = strtol(optarg, NULL, 10);
+                       dom0_domid = get_optval_int(optarg);
                        break;
                case 'p':
-                       priv_domid = strtol(optarg, NULL, 10);
+                       priv_domid = get_optval_int(optarg);
                        break;
 #ifndef NO_LIVE_UPDATE
                case 'U':
-- 
2.35.3




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.