[PATCH 11/28] testcpg: Check length of input group name

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

 



Signed-off-by: Jan Friesse <jfriesse@xxxxxxxxxx>
---
 test/testcpg.c   |    5 +++++
 test/testcpgzc.c |    5 +++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/test/testcpg.c b/test/testcpg.c
index 911140c..5aecc13 100644
--- a/test/testcpg.c
+++ b/test/testcpg.c
@@ -334,6 +334,11 @@ int main (int argc, char *argv[]) {
 	}
 
 	if (argc > optind) {
+		if (strlen(argv[optind]) >= CPG_MAX_NAME_LENGTH) {
+			fprintf(stderr, "Invalid name for cpg group\n");
+			return (1);
+		}
+
 		strcpy(group_name.value, argv[optind]);
 		group_name.length = strlen(argv[optind]);
 	}
diff --git a/test/testcpgzc.c b/test/testcpgzc.c
index 6b3713b..e4fdccc 100644
--- a/test/testcpgzc.c
+++ b/test/testcpgzc.c
@@ -180,6 +180,11 @@ int main (int argc, char *argv[]) {
 	}
 
 	if (argc > optind) {
+		if (strlen(argv[optind]) >= CPG_MAX_NAME_LENGTH) {
+			fprintf(stderr, "Invalid name for cpg group\n");
+			return (1);
+		}
+
 		strcpy(group_name.value, argv[optind]);
 		group_name.length = strlen(argv[optind])+1;
 	}
-- 
1.7.1

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss




[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux