The encode function in fano.c writes to (2*8*nbytes) chars of symbols.

1) Correct the comment in fano.c to show correct number
2) Make the size of channelbits large enough by using the formula
instead of a constant.  With the smaller value the array was being
overwritten which caused stack corruption on my system.
pull/22/head
Don Reid 2018-11-27 14:49:31 -08:00
rodzic 7e422a1c72
commit b5d0500cfc
2 zmienionych plików z 2 dodań i 2 usunięć

2
fano.c
Wyświetl plik

@ -61,7 +61,7 @@ struct node {
* and easier than trying to pack them more compactly.
*/
int encode(
unsigned char *symbols, // Output buffer, 2*nbytes
unsigned char *symbols, // Output buffer, 2*8*nbytes
unsigned char *data, // Input buffer, nbytes
unsigned int nbytes) { // Number of bytes in data
unsigned long encstate;

Wyświetl plik

@ -300,7 +300,7 @@ int get_wspr_channel_symbols(char* rawmessage, char* hashtab, unsigned char* sym
// printf("Will decode as: %s\n",check_call_loc_pow);
unsigned int nbytes=11; // The message with tail is packed into 11 bytes.
unsigned int nencoded=162;
unsigned int nencoded=(nbytes * 2 * 8); // This is how much encode() writes
unsigned char channelbits[nencoded];
memset(channelbits,0,sizeof(char)*nencoded);