From ba525bdad086dff8647c5d16853596ebfe55d35f Mon Sep 17 00:00:00 2001 From: Thomas Osterried Date: Thu, 16 Sep 2010 19:38:58 +0000 Subject: fix in ax25_aton() and in ax25_aton_arglist() - very old bug: Stored only 7 of max 8 (AX25_MAX_DIGIS) digipeaters from ascii string to the struct full_sockaddr_ax25 *fsap. Why? int n = 0; do { ... } while (n < AX25_MAX_DIGIS && *bp); Everyone should say "oh yes, n = 0; -> do ... while n < MAX_DIGIS". But: in the loop n is increased by one. Thus only 7 of 8 arguments hav been copied. do { ... } while (n <= AX25_MAX_DIGIS && *bp); fixes this issue. --- axutils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'axutils.c') diff --git a/axutils.c b/axutils.c index f6e8713..f33d543 100644 --- a/axutils.c +++ b/axutils.c @@ -108,7 +108,7 @@ int ax25_aton(const char *call, struct full_sockaddr_ax25 *sax) else addrp += sizeof(ax25_address); - } while (n < AX25_MAX_DIGIS && *bp); + } while (n <= AX25_MAX_DIGIS && *bp); free(tmp); @@ -148,7 +148,7 @@ int ax25_aton_arglist(const char *call[], struct full_sockaddr_ax25 *sax) else addrp += sizeof(ax25_address); - } while (n < AX25_MAX_DIGIS && call[argp] != NULL); + } while (n <= AX25_MAX_DIGIS && call[argp] != NULL); /* Tidy up */ sax->fsa_ax25.sax25_ndigis = n - 1; -- cgit v1.2.3