Leaving the last byte in Colorpixel.hex NULL

Added explicit assignment of last byte to the null character, for
appearence's sake.
This commit is contained in:
EvilPudding 2016-04-15 13:24:03 +00:00
parent 08c2380545
commit 96704b2fc0
1 changed files with 4 additions and 1 deletions

View File

@ -74,7 +74,10 @@ uint32_t get_colorpixel(const char *hex) {
/* Store the result in the cache */ /* Store the result in the cache */
struct Colorpixel *cache_pixel = scalloc(1, sizeof(struct Colorpixel)); 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; cache_pixel->pixel = pixel;
SLIST_INSERT_HEAD(&(colorpixels), cache_pixel, colorpixels); SLIST_INSERT_HEAD(&(colorpixels), cache_pixel, colorpixels);