From d900345a6604032e663ed0c8e21ef1557b2dbc5b Mon Sep 17 00:00:00 2001 From: pancake Date: Mon, 28 Oct 2013 02:05:18 +0100 Subject: [PATCH] Fix #266 - [ragg2] exit on invalid input (again) --- binr/ragg2/ragg2.c | 2 ++ libr/util/hex.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/binr/ragg2/ragg2.c b/binr/ragg2/ragg2.c index e23f7ce421..a106a4a568 100644 --- a/binr/ragg2/ragg2.c +++ b/binr/ragg2/ragg2.c @@ -221,6 +221,8 @@ int main(int argc, char **argv) { case 'v': printf ("ragg2 "R2_VERSION" "R2_INCDIR"/sflib\n"); return 0; + default: + return 1; } } diff --git a/libr/util/hex.c b/libr/util/hex.c index cddc21685a..d9099ae4de 100644 --- a/libr/util/hex.c +++ b/libr/util/hex.c @@ -61,6 +61,8 @@ R_API int r_hex_str2bin(const char *in, ut8 *out) { const char *ptr; ut8 c = 0, d = 0; + if (!in || !*in) + return 0; if (!memcmp (in, "0x", 2)) in += 2; for (ptr = in; ; ptr++) {