[libdnet-devel] blob_insert bug
Status: Abandoned
Brought to you by:
dugsong
|
From: Brian C. <bm...@sh...> - 2005-12-28 19:12:51
|
There is a bug in blob_insert, as it has src & dst swapped in the
memmove command.
The proof is in the pudding:
blob_t *b;
char tmp[32];
b = blob_new();
blob_insert(b, "foo", 3);
blob_rewind(b);
blob_insert(b, "bar", 3);
blob_rewind(b);
blob_read(b, tmp, 6);
tmp[6] = 0;
printf("GOT %s\n", tmp);
You should get "GOT barfoo", but it does not. Currently, it gives
"bar".
Attached is a patch that corrects this bug and and updates the test
cases for insert & delete to actually test values instead of return
codes.
Brian
|