From 5fb433a86ab75ccb5862cf830335550bcec1b29f Mon Sep 17 00:00:00 2001 From: Heikki Hannikainen Date: Sun, 2 Mar 2008 21:46:08 +0000 Subject: [PATCH] Fixed compressed position base91 validation a bit (thanks OH2KKU). git-svn-id: http://repo.ham.fi/svn/aprsc/trunk@44 3ce903b1-3385-4e86-93cd-f9a4a239f7ac --- src/parse_aprs.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/parse_aprs.c b/src/parse_aprs.c index b6db849..2079bdf 100644 --- a/src/parse_aprs.c +++ b/src/parse_aprs.c @@ -108,9 +108,19 @@ int parse_aprs_telem(struct pbuf_t *pb, const char *body, const char *body_end) int parse_aprs_mice(struct pbuf_t *pb, const char *body, const char *body_end) { //float lat = 0.0, lng = 0.0; + char *dstcall_start; + char dstcall[CALLSIGNLEN_MAX+1]; fprintf(stderr, "parse_aprs_mice\n"); + /* check that the destination call exists and isn't too large */ + dstcall_start = pb->srccall_end+1; + if (dstcall_start < pb->dstcall_end || pb->dstcall_end - dstcall_start > CALLSIGNLEN_MAX) + return 0; /* eh...? */ + + /* make a local copy, we're going to modify it */ + memcpy(dstcall, dstcall_start, pb->dstcall_end - dstcall_start); + //pbuf_fill_pos(pb, lat, lng, 0, 0); return 0; } @@ -137,7 +147,7 @@ int parse_aprs_compressed(struct pbuf_t *pb, const char *body, const char *body_ /* base-91 check */ for (i = 1; i <= 8; i++) - if (body[i] < 0x21 || body[i] >= 0x7b) + if (body[i] < 0x21 || body[i] > 0x7b) return 0; fprintf(stderr, "\tpassed length and format checks, sym %c%c\n", sym_table, sym_code);