Menu

#267 core dump when accessing view history

open
nobody
None
5
2012-05-30
2012-05-30
No

I downloaded this code and compiled it on 64-bit linux with gcc 4.7.0.

The program works fine except when I try to access the view history.

I opened it up in gdb and tracked it down to an ssprintf call in node_to_nkey function.

After the ssprintf, it overwrote the key file with 0's, probably because it copied more than it should in the keynum var of the struct.

I fixed it with the following function:

BOOLEAN
node_to_nkey (NODE node, NKEY * nkey)
{
char keynum[MAXKEYWIDTH];
nkey_clear(nkey);
if (!node) {
*nkey = nkey_zero();
return FALSE;
}
strcpy(nkey->key, node_to_key(node));
strcpy(keynum,&nkey->key[1]);
nkey->ntype = nkey->key[0];
nkey->keynum = atoi(keynum);
return TRUE;
}

Discussion


Log in to post a comment.