]> git.sur5r.net Git - i3/i3/commitdiff
Leaving the last byte in Colorpixel.hex NULL 2301/head
authorEvilPudding <jota.rod@hotmail.com>
Fri, 15 Apr 2016 13:24:03 +0000 (13:24 +0000)
committerEvilPudding <jota.rod@hotmail.com>
Wed, 3 Aug 2016 13:09:58 +0000 (13:09 +0000)
Added explicit assignment of last byte to the null character, for
appearence's sake.

libi3/get_colorpixel.c

index 218f82e6f5c25ce1eac70d2c1b5d43f4c427d612..dc6d774825ed53ff74f7d3434c9c2b2826b5b325 100644 (file)
@@ -74,7 +74,10 @@ uint32_t get_colorpixel(const char *hex) {
 
     /* Store the result in the cache */
     struct Colorpixel *cache_pixel = scalloc(1, sizeof(struct Colorpixel));
-    strncpy(cache_pixel->hex, hex, 8);
+
+    strncpy(cache_pixel->hex, hex, 7);
+    cache_pixel->hex[7] = '\0';
+
     cache_pixel->pixel = pixel;
 
     SLIST_INSERT_HEAD(&(colorpixels), cache_pixel, colorpixels);