Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 05 Aug 2003 19:40:37 +0200
From:      Thomas Wintergerst <Thomas.Wintergerst@nord-com.net>
To:        hellmuth.michaelis@t-online.de
Cc:        ISDN for BSD <freebsd-isdn@freebsd.org>
Subject:   Re: RFT: capi_msgs.c diff
Message-ID:  <3F2FEC15.4090004@nord-com.net>
In-Reply-To: <20030731142505.F0B35A4@bert.int.kts.org>
References:  <20030731142505.F0B35A4@bert.int.kts.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Hellmuth,

I don't know if You already got another answer. But I have some remarks 
on the diff.

1) The changes are correct and necessary.

2) They are not sufficient. The terminating null byte for dst_telno and 
src_telno must be set right after the strncpy() calls using z as the 
index for it. The later assignment might write behind the memory for the 
  fields. And there must be an else clause to set the two fields to zero 
if there is no corresponding information element in the message.

Hellmuth Michaelis wrote:
> Hi,
> 
> would someone please have a look at this patch (or even verify it :-):
> the patch which makes incoming numbers display and work correctly in 
> isdnd (for active AVM cards):
> 
> *** capi_msgs.c-DIST	Wed Jun 11 01:09:37 2003
> --- capi_msgs.c	Thu Jul 31 16:20:04 2003
> ***************
> *** 532,538 ****
>   	z = x - 1;
>   	if (z >= TELNO_MAX) z = (TELNO_MAX-1);
>   	strncpy(cd->dst_telno, msg, z);
> ! 	msg += x
>   	x = z;
>       }
>       cd->dst_telno[x] = '\0';
> --- 532,538 ----
>   	z = x - 1;
>   	if (z >= TELNO_MAX) z = (TELNO_MAX-1);
>   	strncpy(cd->dst_telno, msg, z);
> ! 	msg += x-1;
>   	x = z;
>       }
>       cd->dst_telno[x] = '\0';
> ***************
> *** 548,554 ****
>   	z = x - 2;
>   	if (z >= TELNO_MAX) z = (TELNO_MAX-1);
>   	strncpy(cd->src_telno, msg, z);
> ! 	msg += x;
>   	x = z;
>       }
>       cd->src_telno[x] = '\0';
> --- 548,554 ----
>   	z = x - 2;
>   	if (z >= TELNO_MAX) z = (TELNO_MAX-1);
>   	strncpy(cd->src_telno, msg, z);
> ! 	msg += x-2;
>   	x = z;
>       }
>       cd->src_telno[x] = '\0';
> 
> hellmuth

-- 

Gruss,

Thomas Wintergerst




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F2FEC15.4090004>