]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Fix CONSTANT_EXPRESSION_RESULT in TimeUtil_StringToDate().
authorOliver Kurth <okurth@vmware.com>
Wed, 16 Jan 2019 22:53:05 +0000 (14:53 -0800)
committerOliver Kurth <okurth@vmware.com>
Wed, 16 Jan 2019 22:53:05 +0000 (14:53 -0800)
Red Hat ran coverity scan on open-vm-tools and found an occurrence
of CONSTANT_EXPRESSION_RESULT in TimeUtil_StringToDate().

open-vm-tools/lib/misc/timeutil.c

index 856db875e449a883846a50a2909e322a4650ef1e..930ee268fd610c8d20759c8a7199f230bad1f59a 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 1998-2018 VMware, Inc. All rights reserved.
+ * Copyright (C) 1998-2019 VMware, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -152,8 +152,8 @@ TimeUtil_StringToDate(TimeUtil_Date *d,  // IN/OUT:
       /* 'YYYY/MM/DD' */
       char temp[16] = { 0 };
 
-      if (!(((date[4] != '/') || (date[7] != '/')) ||
-           ((date[4] != '-') || (date[7] != '-')))) {
+      if (!((date[4] == '/' && date[7] == '/') ||
+            (date[4] == '-' && date[7] == '-'))) {
          return FALSE;
       }