From 11c8394d4e03a4615a6672c1f137bcf2bbf01f30 Mon Sep 17 00:00:00 2001 From: Heikki Hannikainen Date: Tue, 16 Oct 2012 23:51:14 +0300 Subject: [PATCH] parse_aprs: fix symbol parsing from dstcall for NMEA. It didn't always get done, and uninitialized symbol might be used for filtering. --- src/parse_aprs.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/parse_aprs.c b/src/parse_aprs.c index e38a42f..800dddd 100644 --- a/src/parse_aprs.c +++ b/src/parse_aprs.c @@ -317,8 +317,15 @@ static int parse_aprs_nmea(struct pbuf_t *pb, const char *body, const char *body const char *latp, *lngp; int i, la, lo; char lac, loc; - char sym_table, sym_code; + char sym_table = ' ', sym_code = ' '; + // Parse symbol from destination callsign, first thing before any possible returns + get_symbol_from_dstcall(pb, &sym_table, &sym_code); +#ifdef DEBUG_PARSE_APRS + hlog(LOG_DEBUG, "get_symbol_from_dstcall: %.*s => %c%c", + (int)(pb->dstcall_end_or_ssid - pb->srccall_end-1), pb->srccall_end+1, sym_table, sym_code); +#endif + if (memcmp(body,"ULT",3) == 0) { /* Ah.. "$ULT..." - that is, Ultimeter 2000 weather instrument */ pb->packettype |= T_WX; @@ -542,13 +549,6 @@ static int parse_aprs_nmea(struct pbuf_t *pb, const char *body, const char *body pb->packettype |= T_POSITION; - // Parse symbol from destination callsign - get_symbol_from_dstcall(pb, &sym_table, &sym_code); -#ifdef DEBUG_PARSE_APRS - hlog(LOG_DEBUG, "get_symbol_from_dstcall: %.*s => %c%c", - (int)(pb->dstcall_end_or_ssid - pb->srccall_end-1), pb->srccall_end+1, sym_table, sym_code); -#endif - return pbuf_fill_pos(pb, lat, lng, sym_table, sym_code); }