78497: Subject: [PATCH] avicap32: Fixed a TOCTOU (check vs use) ordering issue (Coverity)

buildbot at kegel.com buildbot at kegel.com
Wed Sep 7 09:04:32 CDT 2011


This is an experimental automated build and test service.
Please feel free to ignore this email while we work the kinks out.

The Buildbot has detected a failed build on builder runtests-default while building Wine.
Full details are available at: http://buildbot.kegel.com/builders/runtests-default/builds/64 (though maybe not for long, as I'm still reinstalling the buildbot periodically while experimenting)
BUILD FAILED: failed shell_3


For more info about this message, see http://wiki.winehq.org/BuildBot


-------------- next part --------------
From: Marcus Meissner <meissner at suse.de>
Subject: [PATCH] avicap32: Fixed a TOCTOU (check vs use) ordering issue (Coverity)
Message-Id: <1315401549-29242-1-git-send-email-meissner at suse.de>
Date: Wed,  7 Sep 2011 15:19:09 +0200

Hi,

One of the easier fixes. CID 4623

Ciao, Marcus
---
 dlls/avicap32/avicap32_main.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/dlls/avicap32/avicap32_main.c b/dlls/avicap32/avicap32_main.c
index 3d0b661..5816403 100644
--- a/dlls/avicap32/avicap32_main.c
+++ b/dlls/avicap32/avicap32_main.c
@@ -112,7 +112,13 @@ static BOOL query_video_device(int devnum, char *name, int namesize, char *versi
 
    snprintf(device, sizeof(device), "/dev/video%i", devnum);
 
-   if (stat (device, &st) == -1) {
+   fd = open(device, O_RDWR | O_NONBLOCK);
+   if (fd == -1) {
+      ERR("%s: Failed to open: %s\n", device, strerror(errno));
+      return FALSE;
+   }
+
+   if (fstat (fd, &st) == -1) {
       /* This is probably because the device does not exist */
       WARN("%s: %s\n", device, strerror(errno));
       return FALSE;
@@ -123,12 +129,6 @@ static BOOL query_video_device(int devnum, char *name, int namesize, char *versi
       return FALSE;
    }
 
-   fd = open(device, O_RDWR | O_NONBLOCK);
-   if (fd == -1) {
-      ERR("%s: Failed to open: %s\n", device, strerror(errno));
-      return FALSE;
-   }
-
    memset(&caps, 0, sizeof(caps));
    if (xioctl(fd, VIDIOC_QUERYCAP, &caps) != -1) {
       lstrcpynA(name, (char *)caps.card, namesize);
-- 
1.7.1



More information about the wine-tests-results mailing list