summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Osterried <thomas@osterried.de>2010-09-16 19:38:58 +0000
committerThomas Osterried <thomas@osterried.de>2010-09-16 19:38:58 +0000
commitba525bdad086dff8647c5d16853596ebfe55d35f (patch)
tree54f044a41bbd6694c1726e177141b9a2cbcfd0fc
parente820dc0abd4daa32e2df8c1f306b4d9051f445c0 (diff)
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.
-rw-r--r--axutils.c4
1 files changed, 2 insertions, 2 deletions
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;