X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fhelper%2Fbinarybuffer.c;h=ddfcced04e9686e5524fb2b2f53cedbd77bf4564;hb=167ce32a7cb99962e6ae8f8c6d36b0999c16888c;hp=acc8237eb08323fcdfab29fbb3623b0a2a061025;hpb=999f86b92b8efe89976e8196a19350a9822e0ca7;p=fw%2Fopenocd diff --git a/src/helper/binarybuffer.c b/src/helper/binarybuffer.c index acc8237eb..ddfcced04 100644 --- a/src/helper/binarybuffer.c +++ b/src/helper/binarybuffer.c @@ -354,7 +354,12 @@ int str_to_buf(char* str, int str_len, u8 *buf, int buf_len, int radix) } for (j = 0; j < CEIL(buf_len, 8); j++) - buf[j] = b256_buf[j]; + { + if (j < b256_len) + buf[j] = b256_buf[j]; + else + buf[j] = 0; + } /* mask out bits that don't belong to the buffer */ if (buf_len % 8) @@ -366,7 +371,7 @@ int str_to_buf(char* str, int str_len, u8 *buf, int buf_len, int radix) return i; } -int buf_to_u32_handler(u8 *in_buf, void *priv) +int buf_to_u32_handler(u8 *in_buf, void *priv, struct scan_field_s *field) { u32 *dest = priv;