From 27c36af411c7c4d75dd25d79fc76dd92c6bb9643 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 19 Jan 2012 12:30:43 -0500 Subject: [PATCH] Fix OOB in hb-shape --- util/options.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/options.cc b/util/options.cc index 5ded644e8..6585eb4db 100644 --- a/util/options.cc +++ b/util/options.cc @@ -631,7 +631,7 @@ text_options_t::get_line (unsigned int *len) char buf[BUFSIZ]; while (fgets (buf, sizeof (buf), fp)) { unsigned int bytes = strlen (buf); - if (buf[bytes - 1] == '\n') { + if (bytes && buf[bytes - 1] == '\n') { bytes--; g_string_append_len (gs, buf, bytes); break;