29
29
#include <linux/in6.h>
30
30
#include <linux/inet.h>
31
31
#include <linux/kernel.h>
32
+ #include <linux/version.h>
33
+ #if LINUX_VERSION_CODE > KERNEL_VERSION (5 ,10 ,0 )
34
+ #include <linux/kstrtox.h>
35
+ #endif
32
36
#include <linux/ip.h>
33
37
#include <linux/udp.h>
34
38
#include <linux/icmp.h>
67
71
# include <net/netfilter/nf_conntrack.h>
68
72
# include <net/netfilter/nf_conntrack_core.h>
69
73
#endif
70
- #include <linux/version.h>
71
74
#include <asm/unaligned.h>
72
75
#ifdef HAVE_LLIST
73
76
/* llist.h is officially defined since linux 3.1,
@@ -2396,7 +2399,7 @@ static int add_destinations(const char *ptr)
2396
2399
++ end ;
2397
2400
if (succ &&
2398
2401
(* end == ':' || * end == '.' || * end == 'p' || * end == '#' ))
2399
- sin6 -> sin6_port = htons (strtoul (++ end , (char * * )& end , 0 ));
2402
+ sin6 -> sin6_port = htons (simple_strtoul (++ end , (char * * )& end , 0 ));
2400
2403
if (succ && * end == '@' ) {
2401
2404
++ end ;
2402
2405
sout -> sin6_family = AF_INET6 ;
@@ -2411,7 +2414,7 @@ static int add_destinations(const char *ptr)
2411
2414
sin -> sin_port = htons (2055 );
2412
2415
succ = in4_pton (ptr , len , (u8 * )& sin -> sin_addr , -1 , & end );
2413
2416
if (succ && * end == ':' )
2414
- sin -> sin_port = htons (strtoul (++ end , (char * * )& end , 0 ));
2417
+ sin -> sin_port = htons (simple_strtoul (++ end , (char * * )& end , 0 ));
2415
2418
if (succ && * end == '@' ) {
2416
2419
++ end ;
2417
2420
sout -> sin_family = AF_INET ;
@@ -4087,7 +4090,7 @@ static int ethtool_drvinfo(unsigned char *ptr, size_t size, struct net_device *d
4087
4090
ops -> get_drvinfo (dev , & info );
4088
4091
#if LINUX_VERSION_CODE >= KERNEL_VERSION (2 ,6 ,37 )
4089
4092
else if (dev -> dev .parent && dev -> dev .parent -> driver ) {
4090
- strlcpy (info .driver , dev -> dev .parent -> driver -> name , sizeof (info .driver ));
4093
+ strscpy (info .driver , dev -> dev .parent -> driver -> name , sizeof (info .driver ));
4091
4094
}
4092
4095
#endif
4093
4096
n = scnprintf (ptr , len , "%s" , info .driver );
@@ -5684,7 +5687,7 @@ static int __init ipt_netflow_init(void)
5684
5687
if (!destination )
5685
5688
destination = destination_buf ;
5686
5689
if (destination != destination_buf ) {
5687
- strlcpy (destination_buf , destination , sizeof (destination_buf ));
5690
+ strscpy (destination_buf , destination , sizeof (destination_buf ));
5688
5691
destination = destination_buf ;
5689
5692
}
5690
5693
if (add_destinations (destination ) < 0 )
@@ -5694,7 +5697,7 @@ static int __init ipt_netflow_init(void)
5694
5697
if (!aggregation )
5695
5698
aggregation = aggregation_buf ;
5696
5699
if (aggregation != aggregation_buf ) {
5697
- strlcpy (aggregation_buf , aggregation , sizeof (aggregation_buf ));
5700
+ strscpy (aggregation_buf , aggregation , sizeof (aggregation_buf ));
5698
5701
aggregation = aggregation_buf ;
5699
5702
}
5700
5703
add_aggregation (aggregation );
@@ -5704,7 +5707,7 @@ static int __init ipt_netflow_init(void)
5704
5707
if (!sampler )
5705
5708
sampler = sampler_buf ;
5706
5709
if (sampler != sampler_buf ) {
5707
- strlcpy (sampler_buf , sampler , sizeof (sampler_buf ));
5710
+ strscpy (sampler_buf , sampler , sizeof (sampler_buf ));
5708
5711
sampler = sampler_buf ;
5709
5712
}
5710
5713
parse_sampler (sampler );
@@ -5721,7 +5724,7 @@ static int __init ipt_netflow_init(void)
5721
5724
if (!snmp_rules )
5722
5725
snmp_rules = snmp_rules_buf ;
5723
5726
if (snmp_rules != snmp_rules_buf ) {
5724
- strlcpy (snmp_rules_buf , snmp_rules , sizeof (snmp_rules_buf ));
5727
+ strscpy (snmp_rules_buf , snmp_rules , sizeof (snmp_rules_buf ));
5725
5728
snmp_rules = snmp_rules_buf ;
5726
5729
}
5727
5730
add_snmp_rules (snmp_rules );
0 commit comments