osc: fix scaling of legacy formatted color specifiers

This commit is contained in:
Daniel Eklöf 2020-05-02 22:57:12 +02:00
parent ef637fb5e8
commit ac58d05c6b
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 4 additions and 4 deletions

View file

@ -63,7 +63,7 @@
* Trackpad sloooow scrolling to eventually scroll a line.
* Memory leak in terminal reset.
* Translation of cursor coordinates on resize
* Scaling of legacy formatted color specifiers in OSC sequences.
### Security

6
osc.c
View file

@ -239,9 +239,9 @@ parse_legacy_color(const char *string, uint32_t *color)
}
/* Re-scale to 8-bit */
uint8_t r = 255 * (rgb[0] / 65535.);
uint8_t g = 255 * (rgb[1] / 65535.);
uint8_t b = 255 * (rgb[2] / 65535.);
uint8_t r = 256 * (rgb[0] / 65536.);
uint8_t g = 256 * (rgb[1] / 65536.);
uint8_t b = 256 * (rgb[2] / 65536.);
LOG_DBG("legacy: %02x%02x%02x", r, g, b);
*color = r << 16 | g << 8 | b;