Module: Mesa
Branch: master
Commit: f9763b20542619bec57163ae45480626c76d4378
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f9763b20542619bec57163ae45480626c76d4378

Author: Martin Peres <[email protected]>
Date:   Thu Oct 15 18:27:27 2020 +0300

driconf: initialize the option value before using it

ParseValue is freeing the pointer if the address is != 0. However,
since we allocate this value on the stack, we need to initialize the
data first.

Reviewed-by: Adam Jackson <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Signed-off-by: Martin Peres <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7212>

---

 src/util/xmlconfig.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/util/xmlconfig.c b/src/util/xmlconfig.c
index f036185060c..4bd5339b939 100644
--- a/src/util/xmlconfig.c
+++ b/src/util/xmlconfig.c
@@ -377,6 +377,10 @@ driParseOptionInfo(driOptionCache *info,
       char *envVal = getenv(name);
       if (envVal != NULL) {
          driOptionValue v;
+
+         /* make sure the value is initialized to something sensible */
+         v._string = NULL;
+
          if (parseValue(&v, opt->info.type, envVal) &&
              checkValue(&v, optinfo)) {
             /* don't use XML_WARNING, we want the user to see this! */

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to