Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/gpt when calling dehumanize_number() make sure the resu...
details: https://anonhg.NetBSD.org/src/rev/dc4a9dfabcbd
branches: trunk
changeset: 791679:dc4a9dfabcbd
user: jnemeth <jnemeth%NetBSD.org@localhost>
date: Thu Nov 28 01:37:14 2013 +0000
description:
when calling dehumanize_number() make sure the resulting number is >= 1
diffstat:
sbin/gpt/add.c | 6 +++++-
sbin/gpt/label.c | 4 +++-
sbin/gpt/remove.c | 4 +++-
sbin/gpt/resize.c | 4 +++-
4 files changed, 14 insertions(+), 4 deletions(-)
diffs (93 lines):
diff -r e72576e6288b -r dc4a9dfabcbd sbin/gpt/add.c
--- a/sbin/gpt/add.c Wed Nov 27 22:18:06 2013 +0000
+++ b/sbin/gpt/add.c Thu Nov 28 01:37:14 2013 +0000
@@ -29,7 +29,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: add.c,v 1.20 2013/11/27 01:47:53 jnemeth Exp $");
+__RCSID("$NetBSD: add.c,v 1.21 2013/11/28 01:37:14 jnemeth Exp $");
#endif
#include <sys/types.h>
@@ -203,6 +203,8 @@
if (dehumanize_number(optarg, &human_num) < 0)
usage_add();
alignment = human_num;
+ if (alignment < 1)
+ usage_add();
break;
case 'b':
if (block > 0)
@@ -210,6 +212,8 @@
if (dehumanize_number(optarg, &human_num) < 0)
usage_add();
block = human_num;
+ if (block < 1)
+ usage_add();
break;
case 'i':
if (entry > 0)
diff -r e72576e6288b -r dc4a9dfabcbd sbin/gpt/label.c
--- a/sbin/gpt/label.c Wed Nov 27 22:18:06 2013 +0000
+++ b/sbin/gpt/label.c Thu Nov 28 01:37:14 2013 +0000
@@ -29,7 +29,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/label.c,v 1.3 2006/10/04 18:20:25 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: label.c,v 1.13 2013/11/27 01:47:53 jnemeth Exp $");
+__RCSID("$NetBSD: label.c,v 1.14 2013/11/28 01:37:14 jnemeth Exp $");
#endif
#include <sys/types.h>
@@ -197,6 +197,8 @@
if (dehumanize_number(optarg, &human_num) < 0)
usage_label();
block = human_num;
+ if (block < 1)
+ usage_label();
break;
case 'f':
if (name != NULL)
diff -r e72576e6288b -r dc4a9dfabcbd sbin/gpt/remove.c
--- a/sbin/gpt/remove.c Wed Nov 27 22:18:06 2013 +0000
+++ b/sbin/gpt/remove.c Thu Nov 28 01:37:14 2013 +0000
@@ -29,7 +29,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/remove.c,v 1.10 2006/10/04 18:20:25 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: remove.c,v 1.11 2013/11/27 01:47:53 jnemeth Exp $");
+__RCSID("$NetBSD: remove.c,v 1.12 2013/11/28 01:37:14 jnemeth Exp $");
#endif
#include <sys/types.h>
@@ -169,6 +169,8 @@
if (dehumanize_number(optarg, &human_num) < 0)
usage_remove();
block = human_num;
+ if (block < 1)
+ usage_remove();
break;
case 'i':
if (entry > 0)
diff -r e72576e6288b -r dc4a9dfabcbd sbin/gpt/resize.c
--- a/sbin/gpt/resize.c Wed Nov 27 22:18:06 2013 +0000
+++ b/sbin/gpt/resize.c Thu Nov 28 01:37:14 2013 +0000
@@ -29,7 +29,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: resize.c,v 1.4 2013/11/27 20:34:34 christos Exp $");
+__RCSID("$NetBSD: resize.c,v 1.5 2013/11/28 01:37:14 jnemeth Exp $");
#endif
#include <sys/types.h>
@@ -188,6 +188,8 @@
if (dehumanize_number(optarg, &human_num) < 0)
usage_resize();
alignment = human_num;
+ if (alignment < 1)
+ usage_resize();
break;
case 'i':
if (entry > 0)
Home |
Main Index |
Thread Index |
Old Index