diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-09-18 14:06:41 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-09-18 14:06:41 -0700 |
commit | 71ab94418ead8f59c6124e8b3e53f8df7340f095 (patch) | |
tree | 7ba9e8adf2e9781fa5551b568d3fe6c63eb06f0a | |
parent | 6f714830da6c8d74f024be6b0bb32c1ea39c1217 (diff) |
XRRGetCrtcGamma() returns the exact same size information as
XRRGetCrtcGammaSize(), so just use it instead of waiting for
the X server to send it an extra time.
(And if something has gone very wrong so that they aren't the same,
this avoids out-of-bounds reads processing the returned gamma arrays
by using the size of the arrays we allocated.)
Reported-by: Gregory James DUCK <gjduck@gmail.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | xrandr.c | 7 |
1 files changed, 1 insertions, 6 deletions
@@ -1063,17 +1063,12 @@ set_gamma_info(output_t *output) if (!output->crtc_info) return; - size = XRRGetCrtcGammaSize(dpy, output->crtc_info->crtc.xid); - if (!size) { - warning("Failed to get size of gamma for output %s\n", output->output.string); - return; - } - crtc_gamma = XRRGetCrtcGamma(dpy, output->crtc_info->crtc.xid); if (!crtc_gamma) { warning("Failed to get gamma for output %s\n", output->output.string); return; } + size = crtc_gamma->size; /* * Here is a bit tricky because gamma is a whole curve for each |