From: marshmellow42 Date: Thu, 10 Dec 2015 01:40:12 +0000 (-0500) Subject: fix sprint_bin bug i made :( X-Git-Tag: v2.3.0~13^2~1 X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/7bc6fac3ce7720791d072c02479e0d8170902c59 fix sprint_bin bug i made :( --- diff --git a/client/util.c b/client/util.c index 35af3d66..e8b72e81 100644 --- a/client/util.c +++ b/client/util.c @@ -126,7 +126,12 @@ char *sprint_hex(const uint8_t *data, const size_t len) { char *sprint_bin_break(const uint8_t *data, const size_t len, const uint8_t breaks) { // make sure we don't go beyond our char array memory - int max_len = ( len+(len/breaks) > MAX_BIN_BREAK_LENGTH ) ? MAX_BIN_BREAK_LENGTH : len+(len/breaks); + int max_len; + if (breaks==0) + max_len = ( len > MAX_BIN_BREAK_LENGTH ) ? MAX_BIN_BREAK_LENGTH : len; + else + max_len = ( len+(len/breaks) > MAX_BIN_BREAK_LENGTH ) ? MAX_BIN_BREAK_LENGTH : len+(len/breaks); + static char buf[MAX_BIN_BREAK_LENGTH]; // 3072 + end of line characters if broken at 8 bits //clear memory memset(buf, 0x00, sizeof(buf));