From 1a7064b86be0898eead7323b94084ebfdbb05686 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Sun, 5 Feb 2012 09:46:46 +0100 Subject: cppchecktells us: Using signed char type as array index. If the value can be greater than 127 there will be a buffer overflow (because of sign extension). -> treating symptoms (pointer conversion and error in case of issues) rather than disease (correct reading from beginning; prevented by string routines not accepting unsigned chars) (bzr r10937) --- src/sp-cursor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/sp-cursor.cpp') diff --git a/src/sp-cursor.cpp b/src/sp-cursor.cpp index 7ccdaadbe..2069bddbd 100644 --- a/src/sp-cursor.cpp +++ b/src/sp-cursor.cpp @@ -145,7 +145,8 @@ GdkPixbuf *sp_cursor_pixbuf_from_xpm(gchar const *const *xpm, GdkColor const& bl for (int i = 0; i < colors; i++) { char const *p = xpm[1 + i]; - char const ccode = *p; + g_assert(*p >=0); + guchar const ccode = (guchar) *p; p++; while (isspace(*p)) { -- cgit v1.2.3