dm: vdisplay_sdl: fix command line option parsing
strcasestr() returns NULL if specified substring is not found, which should be handled when parsing the command line options. Tracked-On: #8439 Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com> Reviewed-by: Jian Jun Chen <jian.jun.chen@intel.com>
This commit is contained in:
parent
ce3f31dcb6
commit
1c8396abef
|
@ -1378,8 +1378,7 @@ int vdpy_parse_cmd_option(const char *opts)
|
|||
stropts = strdup(opts);
|
||||
while ((str = strsep(&stropts, ",")) != NULL) {
|
||||
vscr = vdpy.vscrs + vdpy.vscrs_num;
|
||||
tmp = strcasestr(str, "geometry=");
|
||||
if (str && strcasestr(str, "geometry=fullscreen")) {
|
||||
if ((tmp = strcasestr(str, "geometry=fullscreen")) != NULL) {
|
||||
snum = sscanf(tmp, "geometry=fullscreen:%d", &vscr->pscreen_id);
|
||||
if (snum != 1) {
|
||||
vscr->pscreen_id = 0;
|
||||
|
@ -1392,7 +1391,7 @@ int vdpy_parse_cmd_option(const char *opts)
|
|||
pr_info("virtual display: fullscreen on monitor %d.\n",
|
||||
vscr->pscreen_id);
|
||||
vdpy.vscrs_num++;
|
||||
} else if (str && strcasestr(str, "geometry=")) {
|
||||
} else if ((tmp = strcasestr(str, "geometry=")) != NULL) {
|
||||
snum = sscanf(tmp, "geometry=%dx%d+%d+%d",
|
||||
&vscr->guest_width, &vscr->guest_height,
|
||||
&vscr->org_x, &vscr->org_y);
|
||||
|
|
Loading…
Reference in New Issue