[mutter] xprops: Cut off UTF-8 strings at n_items characters



commit 734402e14d0b3ff22fdc8688e2eae1c4c11c3597
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Jun 23 11:52:47 2015 -0700

    xprops: Cut off UTF-8 strings at n_items characters
    
    There can be junk after here on some X servers.

 src/x11/xprops.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
---
diff --git a/src/x11/xprops.c b/src/x11/xprops.c
index 7b28cc8..f50709a 100644
--- a/src/x11/xprops.c
+++ b/src/x11/xprops.c
@@ -438,8 +438,7 @@ utf8_string_from_results (GetPropertyResults *results,
       return FALSE;
     }
 
-  *str_p = (char*) results->prop;
-  results->prop = NULL;
+  *str_p = g_strndup ((char *) results->prop, results->n_items);
 
   return TRUE;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]