unsigned int num_cons;
uint32_t crtc_id;
char mode_str[64];
- char format_str[5];
+ char format_str[8]; /* need to leave room for "_BE" and terminating \0 */
float vrefresh;
unsigned int fourcc;
drmModeModeInfo *mode;
unsigned int old_fb_id;
struct bo *bo;
struct bo *old_bo;
- char format_str[5]; /* need to leave room for terminating \0 */
+ char format_str[8]; /* need to leave room for "_BE" and terminating \0 */
unsigned int fourcc;
};
}
if (*p == '@') {
- strncpy(pipe->format_str, p + 1, 4);
- pipe->format_str[4] = '\0';
+ len = sizeof(pipe->format_str) - 1;
+ strncpy(pipe->format_str, p + 1, len);
+ pipe->format_str[len] = '\0';
}
pipe->fourcc = util_format_fourcc(pipe->format_str);
static int parse_plane(struct plane_arg *plane, const char *p)
{
+ unsigned int len;
char *end;
plane->plane_id = strtoul(p, &end, 10);
}
if (*end == '@') {
- strncpy(plane->format_str, end + 1, 4);
- plane->format_str[4] = '\0';
+ len = sizeof(plane->format_str) - 1;
+ strncpy(plane->format_str, end + 1, len);
+ plane->format_str[len] = '\0';
} else {
strcpy(plane->format_str, "XR24");
}