[PATCH v3 1/3] revision: use strtol_i() for exclude_parent

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

 



Avoid silent overflow of the int exclude_parent by using the appropriate
function, strtol_i(), to parse its value.

Signed-off-by: René Scharfe <l.s.r@xxxxxx>
---
 revision.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/revision.c b/revision.c
index 36e31942ce..79b88604c7 100644
--- a/revision.c
+++ b/revision.c
@@ -2120,9 +2120,8 @@ static int handle_revision_arg_1(const char *arg_, struct rev_info *revs, int fl
 		int exclude_parent = 1;

 		if (mark[2]) {
-			char *end;
-			exclude_parent = strtoul(mark + 2, &end, 10);
-			if (*end != '\0' || !exclude_parent)
+			if (strtol_i(mark + 2, 10, &exclude_parent) ||
+			    exclude_parent < 1)
 				return -1;
 		}

--
2.37.3




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux