* [PATCH]about eicon: array subscript is above array bounds
@ 2009-12-10 4:04 Jerry Leo
2009-12-10 14:49 ` Karsten Keil
0 siblings, 1 reply; 4+ messages in thread
From: Jerry Leo @ 2009-12-10 4:04 UTC (permalink / raw)
To: isdn; +Cc: linux-kernel, isdn4linux, i4ldeveloper
[-- Attachment #1: Type: text/plain, Size: 3595 bytes --]
Hi, Karsten Keil,
When i compile eicon,there have some waning look like this:
CC [M] drivers/isdn/hardware/eicon/message.o
drivers/isdn/hardware/eicon/message.c: In function ‘add_b23’:
drivers/isdn/hardware/eicon/message.c:8426: warning: array subscript
is above array bounds
drivers/isdn/hardware/eicon/message.c:8427: warning: array subscript
is above array bounds
drivers/isdn/hardware/eicon/message.c:8434: warning: array subscript
is above array bounds
drivers/isdn/hardware/eicon/message.c:8435: warning: array subscript
is above array bounds
drivers/isdn/hardware/eicon/message.c:8436: warning: array subscript
is above array bounds
drivers/isdn/hardware/eicon/message.c:8447: warning: array subscript
is above array bounds
I think the array is short then be used,because the array's max length
is 20, then it will use long than this, the code is in
"drivers/isdn/hardware/eicon/divacapi.h" 1360L, 50994C :
#define T30_MAX_STATION_ID_LENGTH 20
#define T30_MAX_SUBADDRESS_LENGTH 20
#define T30_MAX_PASSWORD_LENGTH 20
typedef struct t30_info_s T30_INFO;
struct t30_info_s {
byte code;
byte rate_div_2400;
byte resolution;
byte data_format;
byte pages_low;
byte pages_high;
byte operating_mode;
byte control_bits_low;
byte control_bits_high;
byte feature_bits_low;
byte feature_bits_high;
byte recording_properties;
byte universal_6;
byte universal_7;
byte station_id_len;
byte head_line_len;
byte station_id[T30_MAX_STATION_ID_LENGTH];
/* byte head_line[]; */
/* byte sub_sep_length; */
/* byte sub_sep_field[]; */
/* byte pwd_length; */
/* byte pwd_field[]; */
/* byte nsf_info_length; */
/* byte nsf_info_field[]; */
};
"drivers/isdn/hardware/eicon/message.c" 15071L, 487328C
if (pos != 0)
{
if (CAPI_MAX_DATE_TIME_LENGTH + 2 +
b3_config_parms[3].length > CAPI_MAX_HEAD_LINE_SPACE)
pos = 0;
else
{
((T30_INFO *)&nlc[1])->station_id[20 + pos++] = ' ';
((T30_INFO *)&nlc[1])->station_id[20 + pos++] = ' ';
len = (byte)b3_config_parms[2].length;
if (len > 20)
len = 20;
if (CAPI_MAX_DATE_TIME_LENGTH + 2 + len + 2 +
b3_config_parms[3].length <= CAPI_MAX_HEAD_LINE_SPACE)
{
for (i = 0; i < len; i++)
((T30_INFO *)&nlc[1])->station_id[20 + pos++] = ((byte
*)b3_config_parms[2].info)[1+i];
((T30_INFO *)&nlc[1])->station_id[20 + pos++] = ' ';
((T30_INFO *)&nlc[1])->station_id[20 + pos++] = ' ';
}
}
}
can this patch commit?
diff -up linux-2.6/drivers/isdn/hardware/eicon/divacapi.h
linux-2.6/drivers/isdn/hardware/eicon/divacapi.h.orig
--- linux-2.6/drivers/isdn/hardware/eicon/divacapi.h 2009-12-10
12:02:46.000000000 +0800
+++ linux-2.6/drivers/isdn/hardware/eicon/divacapi.h.orig 2009-12-10
11:04:07.000000000 +0800
@@ -445,7 +445,7 @@ struct _DIVA_CAPI_ADAPTER {
#define CAPI_MAX_HEAD_LINE_SPACE 89
#define CAPI_MAX_DATE_TIME_LENGTH 18
-#define T30_MAX_STATION_ID_LENGTH 30
+#define T30_MAX_STATION_ID_LENGTH 20
#define T30_MAX_SUBADDRESS_LENGTH 20
#define T30_MAX_PASSWORD_LENGTH 20
[-- Attachment #2: patch --]
[-- Type: application/octet-stream, Size: 499 bytes --]
--- linux-2.6/drivers/isdn/hardware/eicon/divacapi.h.orig 2009-12-10 11:04:07.000000000 +0800
+++ linux-2.6/drivers/isdn/hardware/eicon/divacapi.h 2009-12-10 11:04:36.000000000 +0800
@@ -445,7 +445,7 @@ struct _DIVA_CAPI_ADAPTER {
#define CAPI_MAX_HEAD_LINE_SPACE 89
#define CAPI_MAX_DATE_TIME_LENGTH 18
-#define T30_MAX_STATION_ID_LENGTH 20
+#define T30_MAX_STATION_ID_LENGTH 30
#define T30_MAX_SUBADDRESS_LENGTH 20
#define T30_MAX_PASSWORD_LENGTH 20
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH]about eicon: array subscript is above array bounds
2009-12-10 4:04 [PATCH]about eicon: array subscript is above array bounds Jerry Leo
@ 2009-12-10 14:49 ` Karsten Keil
2009-12-11 1:31 ` Jerry Leo
0 siblings, 1 reply; 4+ messages in thread
From: Karsten Keil @ 2009-12-10 14:49 UTC (permalink / raw)
To: Jerry Leo; +Cc: linux-kernel, isdn4linux, i4ldeveloper, Armin Schindler
On Donnerstag, 10. Dezember 2009 05:04:35 Jerry Leo wrote:
> Hi, Karsten Keil,
>
> When i compile eicon,there have some waning look like this:
This looks wrong, but I do not know this part so well.
Armin ?
>
> CC [M] drivers/isdn/hardware/eicon/message.o
> drivers/isdn/hardware/eicon/message.c: In function ‘add_b23’:
> drivers/isdn/hardware/eicon/message.c:8426: warning: array subscript
> is above array bounds
> drivers/isdn/hardware/eicon/message.c:8427: warning: array subscript
> is above array bounds
> drivers/isdn/hardware/eicon/message.c:8434: warning: array subscript
> is above array bounds
> drivers/isdn/hardware/eicon/message.c:8435: warning: array subscript
> is above array bounds
> drivers/isdn/hardware/eicon/message.c:8436: warning: array subscript
> is above array bounds
> drivers/isdn/hardware/eicon/message.c:8447: warning: array subscript
> is above array bounds
>
> I think the array is short then be used,because the array's max length
> is 20, then it will use long than this, the code is in
> "drivers/isdn/hardware/eicon/divacapi.h" 1360L, 50994C :
>
>
> #define T30_MAX_STATION_ID_LENGTH 20
> #define T30_MAX_SUBADDRESS_LENGTH 20
> #define T30_MAX_PASSWORD_LENGTH 20
>
> typedef struct t30_info_s T30_INFO;
> struct t30_info_s {
> byte code;
> byte rate_div_2400;
> byte resolution;
> byte data_format;
> byte pages_low;
> byte pages_high;
> byte operating_mode;
> byte control_bits_low;
> byte control_bits_high;
> byte feature_bits_low;
> byte feature_bits_high;
> byte recording_properties;
> byte universal_6;
> byte universal_7;
> byte station_id_len;
> byte head_line_len;
> byte station_id[T30_MAX_STATION_ID_LENGTH];
> /* byte head_line[]; */
> /* byte sub_sep_length; */
> /* byte sub_sep_field[]; */
> /* byte pwd_length; */
> /* byte pwd_field[]; */
> /* byte nsf_info_length; */
> /* byte nsf_info_field[]; */
> };
>
> "drivers/isdn/hardware/eicon/message.c" 15071L, 487328C
>
> if (pos != 0)
> {
> if (CAPI_MAX_DATE_TIME_LENGTH + 2 +
> b3_config_parms[3].length > CAPI_MAX_HEAD_LINE_SPACE)
> pos = 0;
> else
> {
> ((T30_INFO *)&nlc[1])->station_id[20 + pos++] = ' ';
> ((T30_INFO *)&nlc[1])->station_id[20 + pos++] = ' ';
> len = (byte)b3_config_parms[2].length;
> if (len > 20)
> len = 20;
> if (CAPI_MAX_DATE_TIME_LENGTH + 2 + len + 2 +
> b3_config_parms[3].length <= CAPI_MAX_HEAD_LINE_SPACE)
> {
> for (i = 0; i < len; i++)
> ((T30_INFO *)&nlc[1])->station_id[20 + pos++] = ((byte
> *)b3_config_parms[2].info)[1+i];
> ((T30_INFO *)&nlc[1])->station_id[20 + pos++] = ' ';
> ((T30_INFO *)&nlc[1])->station_id[20 + pos++] = ' ';
> }
> }
> }
>
>
>
> can this patch commit?
>
Wrong fileorder, this is a reverse patch.
But I think the code should be fixed.
>
> diff -up linux-2.6/drivers/isdn/hardware/eicon/divacapi.h
> linux-2.6/drivers/isdn/hardware/eicon/divacapi.h.orig
> --- linux-2.6/drivers/isdn/hardware/eicon/divacapi.h 2009-12-10
> 12:02:46.000000000 +0800
> +++ linux-2.6/drivers/isdn/hardware/eicon/divacapi.h.orig 2009-12-10
> 11:04:07.000000000 +0800
> @@ -445,7 +445,7 @@ struct _DIVA_CAPI_ADAPTER {
> #define CAPI_MAX_HEAD_LINE_SPACE 89
> #define CAPI_MAX_DATE_TIME_LENGTH 18
>
> -#define T30_MAX_STATION_ID_LENGTH 30
> +#define T30_MAX_STATION_ID_LENGTH 20
> #define T30_MAX_SUBADDRESS_LENGTH 20
> #define T30_MAX_PASSWORD_LENGTH 20
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH]about eicon: array subscript is above array bounds
2009-12-10 14:49 ` Karsten Keil
@ 2009-12-11 1:31 ` Jerry Leo
0 siblings, 0 replies; 4+ messages in thread
From: Jerry Leo @ 2009-12-11 1:31 UTC (permalink / raw)
To: isdn; +Cc: linux-kernel, isdn4linux, i4ldeveloper, Armin Schindler
[-- Attachment #1: Type: text/plain, Size: 4897 bytes --]
Okay,
this is the patch i have tested. :)
diff --git a/linux-2.6/drivers/isdn/hardware/eicon/divacapi.h.orig
b/linux-2.6/drivers/isdn/hardware/eicon/divacapi.h
index 9f5b680..d9462f7 100644
--- a/linux-2.6/drivers/isdn/hardware/eicon/divacapi.h.orig
+++ b/linux-2.6/drivers/isdn/hardware/eicon/divacapi.h
@@ -445,7 +445,7 @@ struct _DIVA_CAPI_ADAPTER {
#define CAPI_MAX_HEAD_LINE_SPACE 89
#define CAPI_MAX_DATE_TIME_LENGTH 18
-#define T30_MAX_STATION_ID_LENGTH 20
+#define T30_MAX_STATION_ID_LENGTH 30
#define T30_MAX_SUBADDRESS_LENGTH 20
#define T30_MAX_PASSWORD_LENGTH 20
thanks,:)
best regards!
JerryLeo
2009/12/10 Karsten Keil <isdn@linux-pingi.de>:
> On Donnerstag, 10. Dezember 2009 05:04:35 Jerry Leo wrote:
>> Hi, Karsten Keil,
>>
>> When i compile eicon,there have some waning look like this:
>
> This looks wrong, but I do not know this part so well.
>
> Armin ?
>
>>
>> CC [M] drivers/isdn/hardware/eicon/message.o
>> drivers/isdn/hardware/eicon/message.c: In function ‘add_b23’:
>> drivers/isdn/hardware/eicon/message.c:8426: warning: array subscript
>> is above array bounds
>> drivers/isdn/hardware/eicon/message.c:8427: warning: array subscript
>> is above array bounds
>> drivers/isdn/hardware/eicon/message.c:8434: warning: array subscript
>> is above array bounds
>> drivers/isdn/hardware/eicon/message.c:8435: warning: array subscript
>> is above array bounds
>> drivers/isdn/hardware/eicon/message.c:8436: warning: array subscript
>> is above array bounds
>> drivers/isdn/hardware/eicon/message.c:8447: warning: array subscript
>> is above array bounds
>>
>> I think the array is short then be used,because the array's max length
>> is 20, then it will use long than this, the code is in
>> "drivers/isdn/hardware/eicon/divacapi.h" 1360L, 50994C :
>>
>>
>> #define T30_MAX_STATION_ID_LENGTH 20
>> #define T30_MAX_SUBADDRESS_LENGTH 20
>> #define T30_MAX_PASSWORD_LENGTH 20
>>
>> typedef struct t30_info_s T30_INFO;
>> struct t30_info_s {
>> byte code;
>> byte rate_div_2400;
>> byte resolution;
>> byte data_format;
>> byte pages_low;
>> byte pages_high;
>> byte operating_mode;
>> byte control_bits_low;
>> byte control_bits_high;
>> byte feature_bits_low;
>> byte feature_bits_high;
>> byte recording_properties;
>> byte universal_6;
>> byte universal_7;
>> byte station_id_len;
>> byte head_line_len;
>> byte station_id[T30_MAX_STATION_ID_LENGTH];
>> /* byte head_line[]; */
>> /* byte sub_sep_length; */
>> /* byte sub_sep_field[]; */
>> /* byte pwd_length; */
>> /* byte pwd_field[]; */
>> /* byte nsf_info_length; */
>> /* byte nsf_info_field[]; */
>> };
>>
>> "drivers/isdn/hardware/eicon/message.c" 15071L, 487328C
>>
>> if (pos != 0)
>> {
>> if (CAPI_MAX_DATE_TIME_LENGTH + 2 +
>> b3_config_parms[3].length > CAPI_MAX_HEAD_LINE_SPACE)
>> pos = 0;
>> else
>> {
>> ((T30_INFO *)&nlc[1])->station_id[20 + pos++] = ' ';
>> ((T30_INFO *)&nlc[1])->station_id[20 + pos++] = ' ';
>> len = (byte)b3_config_parms[2].length;
>> if (len > 20)
>> len = 20;
>> if (CAPI_MAX_DATE_TIME_LENGTH + 2 + len + 2 +
>> b3_config_parms[3].length <= CAPI_MAX_HEAD_LINE_SPACE)
>> {
>> for (i = 0; i < len; i++)
>> ((T30_INFO *)&nlc[1])->station_id[20 + pos++] = ((byte
>> *)b3_config_parms[2].info)[1+i];
>> ((T30_INFO *)&nlc[1])->station_id[20 + pos++] = ' ';
>> ((T30_INFO *)&nlc[1])->station_id[20 + pos++] = ' ';
>> }
>> }
>> }
>>
>>
>>
>> can this patch commit?
>>
>
> Wrong fileorder, this is a reverse patch.
> But I think the code should be fixed.
>
>>
>> diff -up linux-2.6/drivers/isdn/hardware/eicon/divacapi.h
>> linux-2.6/drivers/isdn/hardware/eicon/divacapi.h.orig
>> --- linux-2.6/drivers/isdn/hardware/eicon/divacapi.h 2009-12-10
>> 12:02:46.000000000 +0800
>> +++ linux-2.6/drivers/isdn/hardware/eicon/divacapi.h.orig 2009-12-10
>> 11:04:07.000000000 +0800
>> @@ -445,7 +445,7 @@ struct _DIVA_CAPI_ADAPTER {
>> #define CAPI_MAX_HEAD_LINE_SPACE 89
>> #define CAPI_MAX_DATE_TIME_LENGTH 18
>>
>> -#define T30_MAX_STATION_ID_LENGTH 30
>> +#define T30_MAX_STATION_ID_LENGTH 20
>> #define T30_MAX_SUBADDRESS_LENGTH 20
>> #define T30_MAX_PASSWORD_LENGTH 20
>>
>
[-- Attachment #2: patch --]
[-- Type: application/octet-stream, Size: 579 bytes --]
diff --git a/linux-2.6/drivers/isdn/hardware/eicon/divacapi.h.orig b/linux-2.6/drivers/isdn/hardware/eicon/divacapi.h
index 9f5b680..d9462f7 100644
--- a/linux-2.6/drivers/isdn/hardware/eicon/divacapi.h.orig
+++ b/linux-2.6/drivers/isdn/hardware/eicon/divacapi.h
@@ -445,7 +445,7 @@ struct _DIVA_CAPI_ADAPTER {
#define CAPI_MAX_HEAD_LINE_SPACE 89
#define CAPI_MAX_DATE_TIME_LENGTH 18
-#define T30_MAX_STATION_ID_LENGTH 20
+#define T30_MAX_STATION_ID_LENGTH 30
#define T30_MAX_SUBADDRESS_LENGTH 20
#define T30_MAX_PASSWORD_LENGTH 20
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH]about eicon: array subscript is above array bounds
@ 2009-12-10 5:46 Jerry Leo
0 siblings, 0 replies; 4+ messages in thread
From: Jerry Leo @ 2009-12-10 5:46 UTC (permalink / raw)
To: isdn; +Cc: linux-kernel, isdn4linux, i4ldeveloper
Hi, Karsten Keil,
When i compile eicon,there have some waning look like this:
CC [M] drivers/isdn/hardware/eicon/message.o
drivers/isdn/hardware/eicon/message.c: In function ‘add_b23’:
drivers/isdn/hardware/eicon/message.c:8426: warning: array subscript
is above array bounds
drivers/isdn/hardware/eicon/message.c:8427: warning: array subscript
is above array bounds
drivers/isdn/hardware/eicon/message.c:8434: warning: array subscript
is above array bounds
drivers/isdn/hardware/eicon/message.c:8435: warning: array subscript
is above array bounds
drivers/isdn/hardware/eicon/message.c:8436: warning: array subscript
is above array bounds
drivers/isdn/hardware/eicon/message.c:8447: warning: array subscript
is above array bounds
I think the array is short then be used,because the array's max length
is 20, then it will use long than this, the code is in
"drivers/isdn/hardware/eicon/divacapi.h" 1360L, 50994C :
#define T30_MAX_STATION_ID_LENGTH 20
#define T30_MAX_SUBADDRESS_LENGTH 20
#define T30_MAX_PASSWORD_LENGTH 20
typedef struct t30_info_s T30_INFO;
struct t30_info_s {
byte code;
byte rate_div_2400;
byte resolution;
byte data_format;
byte pages_low;
byte pages_high;
byte operating_mode;
byte control_bits_low;
byte control_bits_high;
byte feature_bits_low;
byte feature_bits_high;
byte recording_properties;
byte universal_6;
byte universal_7;
byte station_id_len;
byte head_line_len;
byte station_id[T30_MAX_STATION_ID_LENGTH];
/* byte head_line[]; */
/* byte sub_sep_length; */
/* byte sub_sep_field[]; */
/* byte pwd_length; */
/* byte pwd_field[]; */
/* byte nsf_info_length; */
/* byte nsf_info_field[]; */
};
"drivers/isdn/hardware/eicon/message.c" 15071L, 487328C
if (pos != 0)
{
if (CAPI_MAX_DATE_TIME_LENGTH + 2 +
b3_config_parms[3].length > CAPI_MAX_HEAD_LINE_SPACE)
pos = 0;
else
{
((T30_INFO *)&nlc[1])->station_id[20 + pos++] = ' ';
((T30_INFO *)&nlc[1])->station_id[20 + pos++] = ' ';
len = (byte)b3_config_parms[2].length;
if (len > 20)
len = 20;
if (CAPI_MAX_DATE_TIME_LENGTH + 2 + len + 2 +
b3_config_parms[3].length <= CAPI_MAX_HEAD_LINE_SPACE)
{
for (i = 0; i < len; i++)
((T30_INFO *)&nlc[1])->station_id[20 + pos++] = ((byte
*)b3_config_parms[2].info)[1+i];
((T30_INFO *)&nlc[1])->station_id[20 + pos++] = ' ';
((T30_INFO *)&nlc[1])->station_id[20 + pos++] = ' ';
}
}
}
can this patch commit?
diff --git a/linux-2.6/drivers/isdn/hardware/eicon/divacapi.h
b/linux-2.6/drivers/isdn/hardware/eicon/divacapi.h.orig
index d9462f7..9f5b680 100644
--- a/linux-2.6/drivers/isdn/hardware/eicon/divacapi.h
+++ b/linux-2.6/drivers/isdn/hardware/eicon/divacapi.h.orig
@@ -445,7 +445,7 @@ struct _DIVA_CAPI_ADAPTER {
#define CAPI_MAX_HEAD_LINE_SPACE 89
#define CAPI_MAX_DATE_TIME_LENGTH 18
-#define T30_MAX_STATION_ID_LENGTH 30
+#define T30_MAX_STATION_ID_LENGTH 20
#define T30_MAX_SUBADDRESS_LENGTH 20
#define T30_MAX_PASSWORD_LENGTH 20
Jerry Leo
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-12-11 1:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-10 4:04 [PATCH]about eicon: array subscript is above array bounds Jerry Leo
2009-12-10 14:49 ` Karsten Keil
2009-12-11 1:31 ` Jerry Leo
2009-12-10 5:46 Jerry Leo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).