Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Alexander_Naumov:SLE-12:Update
libcaca
bsc1184751-add-space-for-NUL-byte.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bsc1184751-add-space-for-NUL-byte.patch of Package libcaca
Index: libcaca-0.99.beta18/caca/codec/export.c =================================================================== --- libcaca-0.99.beta18.orig/caca/codec/export.c +++ libcaca-0.99.beta18/caca/codec/export.c @@ -27,6 +27,7 @@ #include "caca_internals.h" #include "codec.h" +/* Big endian */ static inline int sprintu32(char *s, uint32_t x) { s[0] = (uint8_t)(x >> 24); @@ -36,6 +37,7 @@ static inline int sprintu32(char *s, uin return 4; } +/* Big endian */ static inline int sprintu16(char *s, uint16_t x) { s[0] = (uint8_t)(x >> 8) & 0xff; @@ -43,6 +45,20 @@ static inline int sprintu16(char *s, uin return 2; } +static inline int write_u8(char *s, uint8_t x) +{ + s[0] = x; + return 1; +} + +static inline int write_string(char *s, char const *d) +{ + int n = 0; + for (; d[n]; ++n) + s[n] = d[n]; + return n; +} + static void *export_caca(caca_canvas_t const *, size_t *); static void *export_html(caca_canvas_t const *, size_t *); static void *export_html3(caca_canvas_t const *, size_t *); @@ -338,7 +354,7 @@ static void *export_html(caca_canvas_t c else if(linechar[x + len] == '\'') cur += sprintf(cur, "'"); else if(linechar[x + len] < 0x00000080) - cur += sprintf(cur, "%c", (uint8_t)linechar[x + len]); + cur += write_u8(cur, (uint8_t)linechar[x + len]); else if((linechar[x + len] <= 0x0010fffd) && ((linechar[x + len] & 0x0000fffe) != 0x0000fffe) @@ -569,7 +585,7 @@ static void *export_html3(caca_canvas_t else if(linechar[x + i] == '\'') cur += sprintf(cur, "'"); else if(linechar[x + i] < 0x00000080) - cur += sprintf(cur, "%c", (uint8_t)linechar[x + i]); + cur += write_u8(cur, (uint8_t)linechar[x + i]); else if((linechar[x + i] <= 0x0010fffd) && ((linechar[x + i] & 0x0000fffe) != 0x0000fffe) @@ -958,7 +974,7 @@ static void *export_tga(caca_canvas_t co cur += sprintf(cur, "%c%c", w & 0xff, w >> 8); /* Width */ cur += sprintf(cur, "%c%c", h & 0xff, h >> 8); /* Height */ cur += sprintf(cur, "%c", 32); /* Pixel Depth */ - cur += sprintf(cur, "%c", 40); /* Image Descriptor */ + cur += write_u8(cur, 40); /* Image Descriptor */ /* Image ID: no ID */ /* Color Map Data: no colormap */ @@ -999,7 +1015,7 @@ static void *export_troff(caca_canvas_t *bytes = 3 + cv->height * 3 + (cv->width * cv->height * 33); cur = data = malloc(*bytes); - cur += sprintf(cur, ".nf\n"); + cur += write_string(cur, ".nf\n"); prevfg = 0; prevbg = 0; @@ -1054,7 +1070,7 @@ static void *export_troff(caca_canvas_t prevbg = bg; started = 1; } - cur += sprintf(cur, "\n"); + cur += write_u8(cur, '\n'); } /* Crop to really used size */ debug("troff export: alloc %lu bytes, realloc %lu",
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor