X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fhelper%2Fbinarybuffer.c;h=7d97891533755ed9bbc2bc5ad41524ddae6ba2be;hb=054b091623edcdc962e8c65066039f38edf2f814;hp=acc8237eb08323fcdfab29fbb3623b0a2a061025;hpb=a1562e8f560759cdd5c36c957bf12137eda9e419;p=openocd diff --git a/src/helper/binarybuffer.c b/src/helper/binarybuffer.c index acc8237e..7d978915 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)