~ubuntu-branches/ubuntu/utopic/thermald/utopic

« back to all changes in this revision

Viewing changes to debian/patches/0035-Klockworks-issue-with-strcasecmp-NULL-param.patch

  • Committer: Package Import Robot
  • Author(s): Colin King
  • Date: 2014-05-19 12:41:22 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20140519124122-zan11arvjxtbqcq5
Tags: 1.2-1
* Adjust for coretemp path change
* Deny non root users to send system bus dbus messages
* Remove compile warning
* Remove rpmlint warning for manual page
* Remove old patches that are now included into version 1.2
* Sync up with version 1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From cb941f51484319c9060a0f99851f25f6b4ef2a33 Mon Sep 17 00:00:00 2001
2
 
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
3
 
Date: Sun, 16 Mar 2014 18:24:03 -0700
4
 
Subject: [PATCH] Klockworks issue with strcasecmp NULL param
5
 
 
6
 
Klockwork complains that strcasecmp will not check NULL, so
7
 
check NULL before calling strcasecamp.
8
 
---
9
 
 src/thd_parse.cpp | 12 ++++++------
10
 
 1 file changed, 6 insertions(+), 6 deletions(-)
11
 
 
12
 
diff --git a/src/thd_parse.cpp b/src/thd_parse.cpp
13
 
index cc393bd..0b137ae 100644
14
 
--- a/src/thd_parse.cpp
15
 
+++ b/src/thd_parse.cpp
16
 
@@ -148,18 +148,18 @@ int cthd_parse::parse_new_trip_point(xmlNode * a_node, xmlDoc *doc,
17
 
                                string_trim(trip_pt->sensor_type);
18
 
                        } else if (!strcasecmp((const char*) cur_node->name, "type")) {
19
 
                                char *type_val = char_trim(tmp_value);
20
 
-                               if (!strcasecmp(type_val, "active"))
21
 
+                               if (type_val && !strcasecmp(type_val, "active"))
22
 
                                        trip_pt->trip_pt_type = ACTIVE;
23
 
-                               else if (!strcasecmp(type_val, "passive"))
24
 
+                               else if (type_val && !strcasecmp(type_val, "passive"))
25
 
                                        trip_pt->trip_pt_type = PASSIVE;
26
 
-                               else if (!strcasecmp(type_val, "critical"))
27
 
+                               else if (type_val && !strcasecmp(type_val, "critical"))
28
 
                                        trip_pt->trip_pt_type = CRITICAL;
29
 
-                               else if (!strcasecmp(type_val, "max"))
30
 
+                               else if (type_val && !strcasecmp(type_val, "max"))
31
 
                                        trip_pt->trip_pt_type = MAX;
32
 
                        } else if (!strcasecmp((const char*) cur_node->name,
33
 
                                        "ControlType")) {
34
 
                                char *ctrl_val = char_trim(tmp_value);
35
 
-                               if (!strcasecmp(ctrl_val, "SEQUENTIAL"))
36
 
+                               if (ctrl_val && !strcasecmp(ctrl_val, "SEQUENTIAL"))
37
 
                                        trip_pt->control_type = SEQUENTIAL;
38
 
                                else
39
 
                                        trip_pt->control_type = PARALLEL;
40
 
@@ -428,7 +428,7 @@ int cthd_parse::parse_new_platform_info(xmlNode * a_node, xmlDoc *doc,
41
 
                        } else if (!strcasecmp((const char*) cur_node->name,
42
 
                                        "Preference")) {
43
 
                                char *pref_val = char_trim(tmp_value);
44
 
-                               if (!strcasecmp(pref_val, "PERFORMANCE"))
45
 
+                               if (pref_val && !strcasecmp(pref_val, "PERFORMANCE"))
46
 
                                        info_ptr->default_prefernce = PREF_PERFORMANCE;
47
 
                                else
48
 
                                        info_ptr->default_prefernce = PREF_ENERGY_CONSERVE;
49
 
1.9.0
50