]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
CONSTANT_EXPRESSION_RESULT in TimeUtil_StringToDate().
authorOliver Kurth <okurth@vmware.com>
Tue, 29 Jan 2019 22:03:19 +0000 (14:03 -0800)
committerOliver Kurth <okurth@vmware.com>
Tue, 29 Jan 2019 22:03:19 +0000 (14:03 -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 9d72563aa2ee22e21797fb1d003f5db5e78d8629..ddd66680c8c27a566892ddf80510dc454bafbe6e 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;
       }