diff options
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/libip6t_owner.c | 1 | ||||
-rw-r--r-- | extensions/libipt_XOR.c | 1 | ||||
-rw-r--r-- | extensions/libipt_helper.c | 1 | ||||
-rw-r--r-- | extensions/libipt_owner.c | 1 | ||||
-rw-r--r-- | extensions/libipt_recent.c | 4 |
5 files changed, 8 insertions, 0 deletions
diff --git a/extensions/libip6t_owner.c b/extensions/libip6t_owner.c index ed785306..6d7258d4 100644 --- a/extensions/libip6t_owner.c +++ b/extensions/libip6t_owner.c @@ -129,6 +129,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, exit_error(PARAMETER_PROBLEM, "OWNER CMD `%s' too long, max %d characters", optarg, sizeof(ownerinfo->comm)); strncpy(ownerinfo->comm, optarg, sizeof(ownerinfo->comm)); + ownerinfo->comm[sizeof(ownerinfo->comm)-1] = '\0'; if (invert) ownerinfo->invert |= IP6T_OWNER_COMM; diff --git a/extensions/libipt_XOR.c b/extensions/libipt_XOR.c index 3b05a309..47d8baac 100644 --- a/extensions/libipt_XOR.c +++ b/extensions/libipt_XOR.c @@ -47,6 +47,7 @@ static int parse(int c, char **argv, int invert, unsigned int *flags, switch (c) { case '1': strncpy(info->key, optarg, 30); + info->key[29] = '\0'; *flags |= IPT_KEY_SET; break; case '2': diff --git a/extensions/libipt_helper.c b/extensions/libipt_helper.c index 4b16e021..72660d94 100644 --- a/extensions/libipt_helper.c +++ b/extensions/libipt_helper.c @@ -46,6 +46,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, case '1': check_inverse(optarg, &invert, &invert, 0); strncpy(info->name, optarg, 29); + info->name[29] = '\0'; if (invert) info->invert = 1; *flags = 1; diff --git a/extensions/libipt_owner.c b/extensions/libipt_owner.c index 73f0ed54..9c92ab2a 100644 --- a/extensions/libipt_owner.c +++ b/extensions/libipt_owner.c @@ -128,6 +128,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, exit_error(PARAMETER_PROBLEM, "OWNER CMD `%s' too long, max %d characters", optarg, sizeof(ownerinfo->comm)); strncpy(ownerinfo->comm, optarg, sizeof(ownerinfo->comm)); + ownerinfo->comm[sizeof(ownerinfo->comm)-1] = '\0'; if (invert) ownerinfo->invert |= IPT_OWNER_COMM; diff --git a/extensions/libipt_recent.c b/extensions/libipt_recent.c index aa32aa07..a3942720 100644 --- a/extensions/libipt_recent.c +++ b/extensions/libipt_recent.c @@ -75,6 +75,9 @@ init(struct ipt_entry_match *match, unsigned int *nfcache) *nfcache |= NFC_UNKNOWN; strncpy(info->name,"DEFAULT",IPT_RECENT_NAME_LEN); + /* eventhough IPT_RECENT_NAME_LEN is currently defined as 200, + * better be safe, than sorry */ + info->name[IPT_RECENT_NAME_LEN-1] = '\0'; info->side = IPT_RECENT_SOURCE; } @@ -142,6 +145,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, case 208: strncpy(info->name,optarg,IPT_RECENT_NAME_LEN); + info->name[IPT_RECENT_NAME_LEN-1] = '\0'; break; case 209: |