Fix bcd stack smash

This commit is contained in:
Nils Olav Selåsdal
2013-01-17 16:30:30 +01:00
parent 4457398da1
commit 7c7a09421a
+4 -4
View File
@@ -16,14 +16,14 @@ uc_ascii2bcd(const char *ascii, unsigned char *bcdout, unsigned char filler)
continue; continue;
} }
*bcdp |= (*ascii - '0') << shift;
if (shift) { if (shift) {
*bcdp |= (*ascii - '0') << 4;
bcdp++; bcdp++;
*bcdp = 0; } else {
*bcdp = (*ascii - '0');
} }
shift = 4 - shift; shift = !shift;
} }
if (shift) { if (shift) {