blob: 0f140fb43c6ab82f912a3522b63878164fb0b4eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
--- linux-2.6.30.9/drivers/net/wireless/rtl8192cd/8192cd_ioctl.c 2013-06-29 15:37:41.982461999 +0300
+++ linux-2.6.30.9/drivers/net/wireless/rtl8192cd/8192cd_ioctl.c 2013-07-01 17:53:46.747055454 +0300
@@ -1537,19 +1537,26 @@
static struct iwpriv_arg *get_tbl_entry(char *pstr)
{
- int i=0;
+ if ( !pstr )
+ return NULL;
+
+ int i = 0;
int arg_num = sizeof(mib_table)/sizeof(struct iwpriv_arg);
- char name[128];
+ char name[sizeof(mib_table[i].name)];
+ memset( name, 0, sizeof name );
- while (*pstr && *pstr != '=')
- name[i++] = *pstr++;
- name[i] = '\0';
+ for ( *pstr; i < sizeof(name); *pstr++ ) {
+ if ( *pstr == '=')
+ break;
+ name[i] = *pstr;
+ i++;
+ }
- for (i=0; i<arg_num; i++) {
- if (!strcmp(name, mib_table[i].name)) {
+ for ( i = 0; i < arg_num; i++ ) {
+ if ( !strncmp( name, mib_table[i].name, sizeof(name) ) )
return &mib_table[i];
- }
}
+
return NULL;
}
|