The isdv4ParseTouchQuery and isdv4ParseTouchData functions
return 0 and -1 if errors occur. At the moment, only the -1
case is being handled, which can result in the callers using
uninitialized ISDV4TouchQueryReply or ISDV4TouchData results.

Signed-off-by: Jason Gerecke <killert...@gmail.com>
---
 src/wcmISDV4.c       | 6 +++---
 tools/tools-shared.c | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/wcmISDV4.c b/src/wcmISDV4.c
index 55439eb..a1a1fdd 100644
--- a/src/wcmISDV4.c
+++ b/src/wcmISDV4.c
@@ -613,10 +613,10 @@ static int isdv4ParseTouchPacket(InputInfoPtr pInfo, 
const unsigned char *data,
        int channel = 0;
 
        rc = isdv4ParseTouchData(data, len, common->wcmPktLength, &touchdata);
-       if (rc == -1)
+       if (rc <= 0)
        {
-               LogMessageVerbSigSafe(X_ERROR, 0, "%s: failed to parse touch 
data.\n",
-                                     pInfo->name);
+               LogMessageVerbSigSafe(X_ERROR, 0, "%s: failed to parse touch 
data (err %d).\n",
+                                     pInfo->name, rc);
                return -1;
        }
 
diff --git a/tools/tools-shared.c b/tools/tools-shared.c
index 256673f..272ed90 100644
--- a/tools/tools-shared.c
+++ b/tools/tools-shared.c
@@ -288,7 +288,7 @@ int query_tablet(int fd)
 
        TRACE("Parsing query reply.\n");
        rc = isdv4ParseQuery(buffer, len, &reply);
-       if (rc < 0)
+       if (rc <= 0)
        {
                fprintf(stderr, "parsing error code %d\n", rc);
                goto out;
@@ -316,7 +316,7 @@ int query_tablet(int fd)
 
                TRACE("Parsing touch query reply.\n");
                rc = isdv4ParseTouchQuery(buffer, len, &touch);
-               if (rc < 0)
+               if (rc <= 0)
                {
                        fprintf(stderr, "touch parsing error code %d\n", rc);
                        touch.sensor_id = 0;
@@ -386,7 +386,7 @@ int parse_touch_packet(unsigned char* buffer, int 
packetlength)
        int rc;
 
        rc = isdv4ParseTouchData(buffer, packetlength, packetlength, 
&touchdata);
-       if (rc == -1) {
+       if (rc <= 0) {
                fprintf(stderr, "failed to parse touch data.\n");
                return -1;
        }
-- 
2.1.0


------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to