Magellan Linux

Annotation of /trunk/hal/patches/hal-0.5.10-dereference-pointer-after-checking-it-s-not-NULL.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 597 - (hide annotations) (download)
Mon May 19 19:05:19 2008 UTC (16 years ago) by niro
File size: 2910 byte(s)
-gentoo patches

1 niro 597 From c80b410ffe27b69a0188e4b1ac39978754135252 Mon Sep 17 00:00:00 2001
2     From: Guillem Jover <guillem.jover@nokia.com>
3     Date: Tue, 20 Nov 2007 15:00:29 +0100
4     Subject: [PATCH] dereference pointer after checking it's not NULL
5    
6     Dereference pointer after checking it's not NULL in
7     partutil/partutil.c.
8     ---
9     partutil/partutil.c | 24 ++++++++++++++++++------
10     1 files changed, 18 insertions(+), 6 deletions(-)
11    
12     diff --git a/partutil/partutil.c b/partutil/partutil.c
13     index 36078c0..b22f9b2 100644
14     --- a/partutil/partutil.c
15     +++ b/partutil/partutil.c
16     @@ -928,11 +928,13 @@ char *
17     part_table_entry_get_type (PartitionTable *p, int entry)
18     {
19     char *s = NULL;
20     - PartitionEntry *pe = g_slist_nth_data (p->entries, entry);
21     + PartitionEntry *pe;
22    
23     if (p == NULL)
24     goto out;
25    
26     + pe = g_slist_nth_data (p->entries, entry);
27     +
28     switch (p->scheme) {
29     case PART_TYPE_GPT:
30     s = get_le_guid (&(pe->data[0]));
31     @@ -959,11 +961,13 @@ char *
32     part_table_entry_get_uuid (PartitionTable *p, int entry)
33     {
34     char *s = NULL;
35     - PartitionEntry *pe = g_slist_nth_data (p->entries, entry);
36     + PartitionEntry *pe;
37    
38     if (p == NULL)
39     goto out;
40    
41     + pe = g_slist_nth_data (p->entries, entry);
42     +
43     switch (p->scheme) {
44     case PART_TYPE_GPT:
45     s = get_le_guid (&(pe->data[16]));
46     @@ -982,11 +986,13 @@ char *
47     part_table_entry_get_label (PartitionTable *p, int entry)
48     {
49     char *s = NULL;
50     - PartitionEntry *pe = g_slist_nth_data (p->entries, entry);
51     + PartitionEntry *pe;
52    
53     if (p == NULL)
54     goto out;
55    
56     + pe = g_slist_nth_data (p->entries, entry);
57     +
58     switch (p->scheme) {
59     case PART_TYPE_GPT:
60     s = g_utf16_to_utf8 ((const gunichar2 *) &(pe->data[56]), 36, NULL, NULL, NULL);
61     @@ -1012,11 +1018,13 @@ part_table_entry_get_flags (PartitionTable *p, int entry)
62     char **ss = NULL;
63     guint32 apm_status;
64     guint64 gpt_attributes;
65     - PartitionEntry *pe = g_slist_nth_data (p->entries, entry);
66     + PartitionEntry *pe;
67    
68     if (p == NULL)
69     goto out;
70    
71     + pe = g_slist_nth_data (p->entries, entry);
72     +
73     ss = g_new0 (char*, 6 + 1); /* hard coded to max items we'll return */
74     ss[0] = NULL;
75     n = 0;
76     @@ -1087,12 +1095,14 @@ guint64
77     part_table_entry_get_offset (PartitionTable *p, int entry)
78     {
79     guint64 val;
80     - PartitionEntry *pe = g_slist_nth_data (p->entries, entry);
81     + PartitionEntry *pe;
82    
83     val = G_MAXUINT64;
84     if (p == NULL)
85     goto out;
86    
87     + pe = g_slist_nth_data (p->entries, entry);
88     +
89     switch (p->scheme) {
90     case PART_TYPE_GPT:
91     val = 0x200 * ((guint64) get_le64 (pe->data + 32));
92     @@ -1122,12 +1132,14 @@ guint64
93     part_table_entry_get_size (PartitionTable *p, int entry)
94     {
95     guint64 val;
96     - PartitionEntry *pe = g_slist_nth_data (p->entries, entry);
97     + PartitionEntry *pe;
98    
99     val = G_MAXUINT64;
100     if (p == NULL)
101     goto out;
102    
103     + pe = g_slist_nth_data (p->entries, entry);
104     +
105     switch (p->scheme) {
106     case PART_TYPE_GPT:
107     val = 0x200 * (((guint64) get_le64 (pe->data + 40)) - ((guint64) get_le64 (pe->data + 32)) + 1);
108     --
109     1.5.3.7
110