summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Yves Avenard <jyavenard@gmail.com>2010-05-13 09:06:41 -0700
committerAaron Plattner <aplattner@nvidia.com>2010-05-13 09:43:10 -0700
commit291e6adb5ddbc574fe673b2d3810839c2fda36bc (patch)
tree3252f30a1cc51db3301038a9b9183c8ab7b3bdc8
parent3fea7a17d771321e355d179b72c836bd5412f33f (diff)
Fix an off-by-one error in nv-control-dpy --print-used-modelines.
The binary data ends with "\0\0" to indicate the end of the MetaMode list. The last time through the loop, j = MetaModeLen - 1 and the check if ((str[j] == '\0') && (str[j+1] != '\0')) { reads past the end of the buffer. Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Andy Ritger <ARitger@nvidia.com>
-rw-r--r--samples/nv-control-dpy.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/samples/nv-control-dpy.c b/samples/nv-control-dpy.c
index 1c02bce..fc6c9f2 100644
--- a/samples/nv-control-dpy.c
+++ b/samples/nv-control-dpy.c
@@ -940,7 +940,7 @@ int main(int argc, char *argv[])
str = start = pMetaModes;
- for (j = 0; j < MetaModeLen; j++) {
+ for (j = 0; j < MetaModeLen - 1; j++) {
/*
* if we found the end of a line, treat the string from