Skip to content
Snippets Groups Projects
Commit 410db4e3 authored by Brian Bruns's avatar Brian Bruns Committed by Jarosław Staniek
Browse files

Bug fix for 'bad' data with odd number of UCS-2 bytes

BUG:396984
mdbtools 9d56b0c3d80cdabc21b
parent 437231a6
No related branches found
No related tags found
No related merge requests found
......@@ -74,6 +74,13 @@ mdb_unicode2ascii(MdbHandle *mdb, char *src, size_t slen, char *dest, size_t dle
//printf("1 len_in %d len_out %d\n",len_in, len_out);
while (1) {
iconv(mdb->iconv_in, &in_ptr, &len_in, &out_ptr, &len_out);
/*
* Have seen database with odd number of bytes in UCS-2, shouldn't happen but protect against it
*/
if (!IS_JET3(mdb) && len_in<=1) {
//fprintf(stderr, "Detected invalid number of UCS-2 bytes\n");
break;
}
if ((!len_in) || (errno == E2BIG)) break;
/* Don't bail if impossible conversion is encountered */
in_ptr += (IS_JET3(mdb)) ? 1 : 2;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment