summaryrefslogtreecommitdiff
path: root/src/libXNVCtrlAttributes
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2015-02-24 07:56:00 -0800
committerAaron Plattner <aplattner@nvidia.com>2015-02-24 07:56:00 -0800
commitc15e4392b924c29d4388b925191dce9e3a46c98a (patch)
treedd710a01b9932e902f1a9b94bc421fdd7f9a3dfc /src/libXNVCtrlAttributes
parenta993b9a192db1490e6388b9934627addf6e9cfc8 (diff)
346.47346.47
Diffstat (limited to 'src/libXNVCtrlAttributes')
-rw-r--r--src/libXNVCtrlAttributes/NvCtrlAttributes.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/libXNVCtrlAttributes/NvCtrlAttributes.c b/src/libXNVCtrlAttributes/NvCtrlAttributes.c
index 748ddc4..4ce6145 100644
--- a/src/libXNVCtrlAttributes/NvCtrlAttributes.c
+++ b/src/libXNVCtrlAttributes/NvCtrlAttributes.c
@@ -393,8 +393,12 @@ int NvCtrlGetScreenWidth(const CtrlTarget *ctrl_target)
return -1;
}
+ if (h->target_id >= NvCtrlGetScreenCount(ctrl_target)) {
+ return -1;
+ }
+
return DisplayWidth(h->dpy, h->target_id);
-
+
} /* NvCtrlGetScreenWidth() */
@@ -411,8 +415,12 @@ int NvCtrlGetScreenHeight(const CtrlTarget *ctrl_target)
return -1;
}
+ if (h->target_id >= NvCtrlGetScreenCount(ctrl_target)) {
+ return -1;
+ }
+
return DisplayHeight(h->dpy, h->target_id);
-
+
} /* NvCtrlGetScreenHeight() */
@@ -519,8 +527,12 @@ int NvCtrlGetScreenWidthMM(const CtrlTarget *ctrl_target)
return -1;
}
+ if (h->target_id >= NvCtrlGetScreenCount(ctrl_target)) {
+ return -1;
+ }
+
return DisplayWidthMM(h->dpy, h->target_id);
-
+
} /* NvCtrlGetScreenWidthMM() */
@@ -537,8 +549,12 @@ int NvCtrlGetScreenHeightMM(const CtrlTarget *ctrl_target)
return -1;
}
+ if (h->target_id >= NvCtrlGetScreenCount(ctrl_target)) {
+ return -1;
+ }
+
return DisplayHeightMM(h->dpy, h->target_id);
-
+
} /* NvCtrlGetScreenHeightMM() */
@@ -555,8 +571,12 @@ int NvCtrlGetScreenPlanes(const CtrlTarget *ctrl_target)
return -1;
}
+ if (h->target_id >= NvCtrlGetScreenCount(ctrl_target)) {
+ return -1;
+ }
+
return DisplayPlanes(h->dpy, h->target_id);
-
+
} /* NvCtrlGetScreenPlanes() */