From c2c982dba920cfddee22b1a0172f4aca09421392 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Mon, 29 Aug 2016 17:02:16 +0000 Subject: [PATCH] Fix an issue with hashing compound callsigns with prefixes shorter than 3 characters git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7044 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/wsprd/wsprd_utils.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/wsprd/wsprd_utils.c b/lib/wsprd/wsprd_utils.c index 8c993287b..1505bcd3f 100644 --- a/lib/wsprd/wsprd_utils.c +++ b/lib/wsprd/wsprd_utils.c @@ -149,7 +149,7 @@ int unpackgrid( int32_t ngrid, char *grid) int unpackpfx( int32_t nprefix, char *call) { - char nc, pfx[4]="", tmpcall[7]=""; + char nc, pfx[4]={'\0'}, tmpcall[7]; int i; int32_t n; @@ -170,8 +170,9 @@ int unpackpfx( int32_t nprefix, char *call) } n=n/37; } - - strcpy(call,pfx); + + char * p = strrchr(pfx,' '); + strcpy(call, p ? p + 1 : pfx); strncat(call,"/",1); strncat(call,tmpcall,strlen(tmpcall));