]> git.pld-linux.org Git - packages/openchange.git/blob - openchange-covscan.patch
- release 57 (samba 4.13.8)
[packages/openchange.git] / openchange-covscan.patch
1 diff -up openchange-openchange-2.3-VULCAN/libexchange2ical/exchange2ical_property.c.covscan openchange-openchange-2.3-VULCAN/libexchange2ical/exchange2ical_property.c
2 --- openchange-openchange-2.3-VULCAN/libexchange2ical/exchange2ical_property.c.covscan  2018-07-19 13:53:41.281450703 +0200
3 +++ openchange-openchange-2.3-VULCAN/libexchange2ical/exchange2ical_property.c  2018-07-19 13:53:41.285450703 +0200
4 @@ -53,6 +53,7 @@ static void openchange_all_string_sub(ch
5         }
6  }
7  
8 +#if 0
9  struct RRULE_byday {
10         uint16_t        DayOfWeek;
11         const char      *DayName;
12 @@ -68,6 +69,7 @@ static const struct RRULE_byday RRULE_by
13         { 0x0006,       "SA" },
14         { 0x0007,       NULL }
15  };
16 +#endif
17  
18  static const char *get_filename(const char *filename)
19  {
20 diff -up openchange-openchange-2.3-VULCAN/libexchange2ical/exchange2ical_utils.c.covscan openchange-openchange-2.3-VULCAN/libexchange2ical/exchange2ical_utils.c
21 --- openchange-openchange-2.3-VULCAN/libexchange2ical/exchange2ical_utils.c.covscan     2018-07-19 13:53:41.281450703 +0200
22 +++ openchange-openchange-2.3-VULCAN/libexchange2ical/exchange2ical_utils.c     2018-07-19 13:53:41.285450703 +0200
23 @@ -232,7 +232,7 @@ uint32_t get_exchange_rdfDays_from_ical(
24  
25  struct icaltimetype get_icaltimetype_from_tm(struct tm *tm)
26  {
27 -       struct icaltimetype tt;
28 +       struct icaltimetype tt = icaltime_null_time ();
29  
30         tt.year   = tm->tm_year+1900;
31         tt.month  = tm->tm_mon+1;
32 @@ -259,7 +259,7 @@ struct icaltimetype get_icaltimetype_fro
33  
34  struct icaltimetype get_icaldate_from_tm(struct tm *tm)
35  {
36 -       struct icaltimetype tt;
37 +       struct icaltimetype tt = icaltime_null_time ();
38  
39         tt.year   = tm->tm_year+1900;
40         tt.month  = tm->tm_mon+1;
41 @@ -292,7 +293,7 @@ struct tm *get_tm_from_FILETIME(const st
42  
43  struct icaltimetype get_icaltime_from_FILETIME(const struct FILETIME *ft)
44  {
45 -       struct icaltimetype     tt;
46 +       struct icaltimetype     tt = icaltime_null_time ();
47         NTTIME                  nttime;
48         struct timeval          temp_timeval;
49         struct tm               *tm;
50 @@ -317,7 +318,7 @@ struct icaltimetype get_icaltime_from_FI
51  
52  struct icaltimetype get_icaltime_from_FILETIME_UTC(const struct FILETIME *ft)
53  {
54 -       struct icaltimetype     tt;
55 +       struct icaltimetype     tt = icaltime_null_time ();
56         NTTIME                  nttime;
57         struct timeval          temp_timeval;
58         struct tm               *tm;
59 @@ -342,7 +343,7 @@ struct icaltimetype get_icaltime_from_FI
60  
61  struct icaltimetype get_icaldate_from_FILETIME(const struct FILETIME *ft)
62  {
63 -       struct icaltimetype     tt;
64 +       struct icaltimetype     tt = icaltime_null_time ();
65         NTTIME                  nttime;
66         struct timeval          temp_timeval;
67         struct tm               *tm;
68 @@ -373,7 +374,7 @@ struct icaltimetype get_icaldate_from_FI
69  
70  struct icaltimetype get_icaldate_from_GlobalObjectId(struct GlobalObjectId *GlobalObjectId)
71  {
72 -       struct icaltimetype     tt;
73 +       struct icaltimetype     tt = icaltime_null_time ();
74         tt.year   = GlobalObjectId->YH;
75         tt.year   = tt.year <<8;
76         tt.year   |= GlobalObjectId->YL;
77 @@ -513,7 +514,10 @@ uint32_t get_minutes_from_icaltimetype(i
78         time_t                  time;
79         NTTIME                  nttime;
80         struct timeval          t;
81 -       
82 +
83 +       if (icaltime_is_null_time(icaltime) || !icaltime_is_valid_time(icaltime))
84 +               return 0;
85 +
86         tm.tm_year      = icaltime.year - 1900;
87         tm.tm_mon       = icaltime.month - 1;
88         tm.tm_mday      = icaltime.day;
89 diff -up openchange-openchange-2.3-VULCAN/libexchange2ical/ical2exchange_property.c.covscan openchange-openchange-2.3-VULCAN/libexchange2ical/ical2exchange_property.c
90 --- openchange-openchange-2.3-VULCAN/libexchange2ical/ical2exchange_property.c.covscan  2015-05-16 17:22:04.000000000 +0200
91 +++ openchange-openchange-2.3-VULCAN/libexchange2ical/ical2exchange_property.c  2018-07-19 13:53:41.286450703 +0200
92 @@ -147,7 +147,6 @@ void ical2exchange_property_CATEGORIES(s
93         struct StringArray_r *sArray;
94         char **stringArray = NULL;
95         char string[256];
96 -       char *value;
97         char *tok;
98         icalproperty *categoriesProp;
99         uint32_t i = 0;
100 @@ -160,8 +159,10 @@ void ical2exchange_property_CATEGORIES(s
101         categoriesProp = icalcomponent_get_first_property(ical2exchange->categoriesEvent, ICAL_CATEGORIES_PROPERTY);
102         sArray->cValues = 0;
103         while(categoriesProp){
104 -       
105 -               value = strdup(icalproperty_get_categories(categoriesProp));
106 +               const char *categories = icalproperty_get_categories(categoriesProp);
107 +               char *value;
108 +
109 +               value = strdup(categories ? categories : "");
110                 tok = strtok(value, ",");
111                 while(tok){
112                         if(!stringArray){
113 @@ -185,6 +186,7 @@ void ical2exchange_property_CATEGORIES(s
114                 }
115                 categoriesProp = icalcomponent_get_next_property(ical2exchange->categoriesEvent, ICAL_CATEGORIES_PROPERTY);
116  
117 +               free(value);
118         }
119         sArray->lppszA= (const char **) stringArray;
120         
121 @@ -519,6 +521,7 @@ void ical2exchange_property_RRULE_EXDATE
122                 
123                 ritr = icalrecur_iterator_new(irt,dtstart);
124                 next=icalrecur_iterator_next(ritr);
125 +               last = icaltime_null_time();
126                 
127                 while (!icaltime_is_null_time(next)){
128                         last = next;
129 diff -up openchange-openchange-2.3-VULCAN/libmapi++/examples/foldertree.cpp.covscan openchange-openchange-2.3-VULCAN/libmapi++/examples/foldertree.cpp
130 --- openchange-openchange-2.3-VULCAN/libmapi++/examples/foldertree.cpp.covscan  2015-05-16 17:22:04.000000000 +0200
131 +++ openchange-openchange-2.3-VULCAN/libmapi++/examples/foldertree.cpp  2018-07-19 13:53:41.286450703 +0200
132 @@ -65,12 +65,12 @@ int main ()
133                 }
134  
135          }
136 -        catch (libmapipp::mapi_exception e) // Catch any MAPI exceptions
137 +        catch (libmapipp::mapi_exception &e) // Catch any MAPI exceptions
138          {
139                  std::cout << "MAPI Exception in main: " <<  e.what()
140                           << std::endl;
141          }
142 -        catch (std::runtime_error e) // Catch any other runtime exceptions
143 +        catch (std::runtime_error &e) // Catch any other runtime exceptions
144          {
145                  std::cout << "std::runtime_error exception in main: "
146                           << e.what() << std::endl;
147 diff -up openchange-openchange-2.3-VULCAN/libmapi++/examples/messages.cpp.covscan openchange-openchange-2.3-VULCAN/libmapi++/examples/messages.cpp
148 --- openchange-openchange-2.3-VULCAN/libmapi++/examples/messages.cpp.covscan    2015-05-16 17:22:04.000000000 +0200
149 +++ openchange-openchange-2.3-VULCAN/libmapi++/examples/messages.cpp    2018-07-19 13:53:41.286450703 +0200
150 @@ -61,12 +61,12 @@ int main ()
151                         }
152                 }
153          }
154 -        catch (libmapipp::mapi_exception e) // Catch any MAPI exceptions
155 +        catch (libmapipp::mapi_exception &e) // Catch any MAPI exceptions
156          {
157                  std::cout << "MAPI Exception in main: " <<  e.what()
158                           << std::endl;
159          }
160 -        catch (std::runtime_error e) // Catch any other runtime exceptions
161 +        catch (std::runtime_error &e) // Catch any other runtime exceptions
162          {
163                  std::cout << "std::runtime_error exception in main: "
164                           << e.what() << std::endl;
165 diff -up openchange-openchange-2.3-VULCAN/libmapi/FXICS.c.covscan openchange-openchange-2.3-VULCAN/libmapi/FXICS.c
166 --- openchange-openchange-2.3-VULCAN/libmapi/FXICS.c.covscan    2015-05-16 17:22:04.000000000 +0200
167 +++ openchange-openchange-2.3-VULCAN/libmapi/FXICS.c    2018-07-19 13:53:41.286450703 +0200
168 @@ -800,6 +800,7 @@ _PUBLIC_ enum MAPISTATUS FXGetBuffer(map
169         if ((retval = mapi_object_get_logon_id(obj_source_context, &logon_id)) != MAPI_E_SUCCESS)
170                 return retval;
171  
172 +       memset(&request, 0, sizeof(struct FastTransferSourceGetBuffer_req));
173         mem_ctx = talloc_named(session, 0, "FXGetBuffer");
174         size = 0;
175  
176 diff -up openchange-openchange-2.3-VULCAN/libmapi/idset.c.covscan openchange-openchange-2.3-VULCAN/libmapi/idset.c
177 --- openchange-openchange-2.3-VULCAN/libmapi/idset.c.covscan    2015-05-16 17:22:04.000000000 +0200
178 +++ openchange-openchange-2.3-VULCAN/libmapi/idset.c    2018-07-19 13:53:41.286450703 +0200
179 @@ -383,6 +383,7 @@ _PUBLIC_ struct idset *IDSET_parse(TALLO
180                         total_bytes += 16;
181                 }
182  
183 +               byte_count = 0;
184                 globset.length = buffer.length - 16;
185                 globset.data = (uint8_t *) buffer.data + 16;
186                 idset->ranges = GLOBSET_parse(idset, globset, &idset->range_count, &byte_count);
187 @@ -1182,7 +1183,8 @@ _PUBLIC_ void RAWIDSET_push_eid(struct r
188                 }
189                 else {
190                         glob_idset = RAWIDSET_make(rawidset->mem_ctx, true, rawidset->single);
191 -                       last_glob_idset->next = glob_idset;
192 +                       if (last_glob_idset)
193 +                               last_glob_idset->next = glob_idset;
194                 }
195                 glob_idset->repl.id = eid_id;
196         }
197 diff -up openchange-openchange-2.3-VULCAN/libmapi/IMAPIProp.c.covscan openchange-openchange-2.3-VULCAN/libmapi/IMAPIProp.c
198 --- openchange-openchange-2.3-VULCAN/libmapi/IMAPIProp.c.covscan        2015-05-16 17:22:04.000000000 +0200
199 +++ openchange-openchange-2.3-VULCAN/libmapi/IMAPIProp.c        2018-07-19 13:53:41.287450703 +0200
200 @@ -1122,6 +1122,7 @@ _PUBLIC_ enum MAPISTATUS QueryNamedPrope
201                 return retval;
202  
203         /* Initialization */
204 +       memset(&request, 0, sizeof(struct QueryNamedProperties_req));
205         mem_ctx = talloc_named(session, 0, "QueryNamesFromIDs");
206         size = 0;
207  
208 diff -up openchange-openchange-2.3-VULCAN/libmapi/IMAPISupport.c.covscan openchange-openchange-2.3-VULCAN/libmapi/IMAPISupport.c
209 --- openchange-openchange-2.3-VULCAN/libmapi/IMAPISupport.c.covscan     2015-05-16 17:22:04.000000000 +0200
210 +++ openchange-openchange-2.3-VULCAN/libmapi/IMAPISupport.c     2018-07-19 13:53:41.287450703 +0200
211 @@ -101,6 +101,7 @@ _PUBLIC_ enum MAPISTATUS Subscribe(mapi_
212         if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
213                 return retval;
214  
215 +       memset(&request, 0, sizeof(struct RegisterNotification_req));
216         mem_ctx = talloc_named(session, 0, "Subscribe");
217  
218         /* Fill the Subscribe operation */
219 diff -up openchange-openchange-2.3-VULCAN/libmapi/IMessage.c.covscan openchange-openchange-2.3-VULCAN/libmapi/IMessage.c
220 --- openchange-openchange-2.3-VULCAN/libmapi/IMessage.c.covscan 2015-05-16 17:22:04.000000000 +0200
221 +++ openchange-openchange-2.3-VULCAN/libmapi/IMessage.c 2018-07-19 13:53:41.287450703 +0200
222 @@ -499,6 +499,8 @@ _PUBLIC_ enum MAPISTATUS SetRecipientTyp
223         enum MAPISTATUS         retval;
224         struct SPropValue       lpProp;
225  
226 +       memset(&lpProp, 0, sizeof(struct SPropValue));
227 +
228         lpProp.ulPropTag = PR_RECIPIENT_TYPE;
229         lpProp.value.l = RecipClass;
230  
231 @@ -1648,6 +1650,7 @@ _PUBLIC_ enum MAPISTATUS OpenEmbeddedMes
232         if ((retval = mapi_object_get_logon_id(obj_attach, &logon_id)) != MAPI_E_SUCCESS)
233                 return retval;
234  
235 +       memset(&lpProp, 0, sizeof(struct SPropValue));
236         mem_ctx = talloc_named(session, 0, "OpenEmbeddedMessage");
237  
238         /* Fill the OpenEmbeddedMessage request */
239 diff -up openchange-openchange-2.3-VULCAN/libmapi/IStoreFolder.c.covscan openchange-openchange-2.3-VULCAN/libmapi/IStoreFolder.c
240 --- openchange-openchange-2.3-VULCAN/libmapi/IStoreFolder.c.covscan     2015-05-16 17:22:04.000000000 +0200
241 +++ openchange-openchange-2.3-VULCAN/libmapi/IStoreFolder.c     2018-07-19 13:53:41.287450703 +0200
242 @@ -93,6 +93,7 @@ _PUBLIC_ enum MAPISTATUS OpenMessage(map
243         if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
244                 return retval;
245  
246 +       memset(&lpProp, 0, sizeof(struct SPropValue));
247         mem_ctx = talloc_named(session, 0, "OpenMessage");
248  
249         /* Fill the OpenMessage operation */
250 @@ -232,6 +233,7 @@ _PUBLIC_ enum MAPISTATUS ReloadCachedInf
251         if ((retval = mapi_object_get_logon_id(obj_message, &logon_id)) != MAPI_E_SUCCESS)
252                 return retval;
253  
254 +       memset(&lpProp, 0, sizeof(struct SPropValue));
255         mem_ctx = talloc_named(session, 0, "ReloadCachedInformation");
256  
257         /* Fill the ReloadCachedInformation operation */
258 diff -up openchange-openchange-2.3-VULCAN/libmapi/IStream.c.covscan openchange-openchange-2.3-VULCAN/libmapi/IStream.c
259 --- openchange-openchange-2.3-VULCAN/libmapi/IStream.c.covscan  2015-05-16 17:22:04.000000000 +0200
260 +++ openchange-openchange-2.3-VULCAN/libmapi/IStream.c  2018-07-19 13:53:41.287450703 +0200
261 @@ -183,6 +183,7 @@ _PUBLIC_ enum MAPISTATUS ReadStream(mapi
262         if ((retval = mapi_object_get_logon_id(obj_stream, &logon_id)) != MAPI_E_SUCCESS)
263                 return retval;
264  
265 +       memset(&request, 0, sizeof(struct ReadStream_req));
266         mem_ctx = talloc_named(session, 0, "ReadStream");
267  
268         *ByteRead = 0;
269 diff -up openchange-openchange-2.3-VULCAN/libmapi++/src/folder.cpp.covscan openchange-openchange-2.3-VULCAN/libmapi++/src/folder.cpp
270 --- openchange-openchange-2.3-VULCAN/libmapi++/src/folder.cpp.covscan   2015-05-16 17:22:04.000000000 +0200
271 +++ openchange-openchange-2.3-VULCAN/libmapi++/src/folder.cpp   2018-07-19 13:53:41.287450703 +0200
272 @@ -57,7 +57,7 @@ folder::message_container_type folder::f
273                                 message_container.push_back(message_shared_ptr(new message(m_session,
274                                                                                            m_id,
275                                                                                            row_set.aRow[i].lpProps[1].value.d)));
276 -                       } catch(mapi_exception e) {
277 +                       } catch(mapi_exception &e) {
278                                 mapi_object_release(&contents_table);
279                                 throw;
280                         }
281 @@ -102,7 +102,7 @@ folder::hierarchy_container_type folder:
282                         try {
283                                 hierarchy_container.push_back(folder_shared_ptr(new folder(*this,
284                                                               row_set.aRow[i].lpProps[0].value.d)));
285 -                       } catch(mapi_exception e) {
286 +                       } catch(mapi_exception &e) {
287                                 mapi_object_release(&hierarchy_table);
288                                 throw;
289                         }
290 diff -up openchange-openchange-2.3-VULCAN/libmapi++/src/message.cpp.covscan openchange-openchange-2.3-VULCAN/libmapi++/src/message.cpp
291 --- openchange-openchange-2.3-VULCAN/libmapi++/src/message.cpp.covscan  2015-05-16 17:22:04.000000000 +0200
292 +++ openchange-openchange-2.3-VULCAN/libmapi++/src/message.cpp  2018-07-19 13:53:41.287450703 +0200
293 @@ -50,7 +50,7 @@ message::attachment_container_type messa
294                         try {
295                                 attachment_container.push_back(attachment_shared_ptr(new attachment(*this, row_set.aRow[i].lpProps[0].value.l)));
296                         }
297 -                       catch(mapi_exception e) {
298 +                       catch(mapi_exception &e) {
299                                 mapi_object_release(&attachment_table);
300                                 throw;
301                         }
302 diff -up openchange-openchange-2.3-VULCAN/libmapi++/src/session.cpp.covscan openchange-openchange-2.3-VULCAN/libmapi++/src/session.cpp
303 --- openchange-openchange-2.3-VULCAN/libmapi++/src/session.cpp.covscan  2015-05-16 17:22:04.000000000 +0200
304 +++ openchange-openchange-2.3-VULCAN/libmapi++/src/session.cpp  2018-07-19 13:53:41.287450703 +0200
305 @@ -61,7 +61,7 @@ void session::login(const std::string& p
306         if (m_profile_name == "") { // if profile is not set, try to get default profile
307                 try {
308                         m_profile_name = profile_database().get_default_profile_name();
309 -               } catch(mapi_exception e) {
310 +               } catch(mapi_exception &e) {
311                         uninitialize();
312                         throw;
313                 }
314 @@ -74,7 +74,7 @@ void session::login(const std::string& p
315  
316         try {
317                 m_message_store->open(m_session);
318 -       } catch (mapi_exception e) {
319 +       } catch (mapi_exception &e) {
320                 throw;
321         }
322  }
323 diff -up openchange-openchange-2.3-VULCAN/libmapi++/tests/attach_test.cpp.covscan openchange-openchange-2.3-VULCAN/libmapi++/tests/attach_test.cpp
324 --- openchange-openchange-2.3-VULCAN/libmapi++/tests/attach_test.cpp.covscan    2015-05-16 17:22:04.000000000 +0200
325 +++ openchange-openchange-2.3-VULCAN/libmapi++/tests/attach_test.cpp    2018-07-19 13:53:41.287450703 +0200
326 @@ -84,11 +84,11 @@ int main()
327  
328                 print_folder_tree(top_folder, mapi_session);
329         }
330 -       catch (mapi_exception e) // Catch any mapi exceptions
331 +       catch (mapi_exception &e) // Catch any mapi exceptions
332         {
333                 cout << "MAPI Exception @ main: " <<  e.what() << endl;
334         }
335 -       catch (std::runtime_error e) // Catch runtime exceptions
336 +       catch (std::runtime_error &e) // Catch runtime exceptions
337         {
338                 cout << "std::runtime_error exception @ main: " << e.what() << endl;
339         }
340 diff -up openchange-openchange-2.3-VULCAN/libmapi++/tests/exception_test.cpp.covscan openchange-openchange-2.3-VULCAN/libmapi++/tests/exception_test.cpp
341 --- openchange-openchange-2.3-VULCAN/libmapi++/tests/exception_test.cpp.covscan 2015-05-16 17:22:04.000000000 +0200
342 +++ openchange-openchange-2.3-VULCAN/libmapi++/tests/exception_test.cpp 2018-07-19 13:53:41.287450703 +0200
343 @@ -12,7 +12,7 @@ int main()
344         try {
345                 dotest();
346         }
347 -       catch (libmapipp::mapi_exception e) {
348 +       catch (libmapipp::mapi_exception &e) {
349                 std::cout << e.what() << std::endl;
350         }
351         
352 diff -up openchange-openchange-2.3-VULCAN/libmapi++/tests/profile_test.cpp.covscan openchange-openchange-2.3-VULCAN/libmapi++/tests/profile_test.cpp
353 --- openchange-openchange-2.3-VULCAN/libmapi++/tests/profile_test.cpp.covscan   2015-05-16 17:22:04.000000000 +0200
354 +++ openchange-openchange-2.3-VULCAN/libmapi++/tests/profile_test.cpp   2018-07-19 13:53:41.287450703 +0200
355 @@ -27,15 +27,18 @@
356  #define PROFILEDB_NAME_TEMPLATE "/tmp/mapidbXXXXXX"
357  int main ()
358  {
359 +       char *tmpname = NULL, *tmpname2 = NULL;
360 +
361         try {
362                 libmapipp::profile_database db;
363  
364                 std::cout << "default profile name: " << db.get_default_profile_name() << std::endl;
365  
366                 {
367 -                       char *tmpname = (char*) calloc(sizeof(PROFILEDB_NAME_TEMPLATE) + 1, sizeof(char));
368 -                       strncpy(tmpname, PROFILEDB_NAME_TEMPLATE, sizeof(PROFILEDB_NAME_TEMPLATE));
369 -                       int ret = mkstemp(tmpname);
370 +                       int ret;
371 +
372 +                       tmpname = strdup(PROFILEDB_NAME_TEMPLATE);
373 +                       ret = mkstemp(tmpname);
374                         if (ret < 0) {
375                                 std::cout << "failed to create temporary file: " << strerror(errno) << std::endl;
376                         }
377 @@ -45,12 +48,15 @@ int main ()
378                                 std::cout << "failed to create a temporary profile store" << std::endl;
379                         }
380                         unlink(tmpname);
381 +                       free(tmpname);
382 +                       tmpname = NULL;
383                 }
384                 
385                 {
386 -                       char *tmpname2 = (char*) calloc(sizeof(PROFILEDB_NAME_TEMPLATE) + 1, sizeof(char));
387 -                       strncpy(tmpname2, PROFILEDB_NAME_TEMPLATE, sizeof(PROFILEDB_NAME_TEMPLATE));
388 -                       int ret = mkstemp(tmpname2);
389 +                       int ret;
390 +
391 +                       tmpname2 = strdup(PROFILEDB_NAME_TEMPLATE);
392 +                       ret = mkstemp(tmpname2);
393                         if (ret < 0) {
394                                 std::cout << "failed to create temporary file: " << strerror(errno) << std::endl;
395                         }
396 @@ -60,19 +66,33 @@ int main ()
397                                 std::cout << "failed to create a temporary profile store with std::string" << std::endl;
398                         }
399                         unlink(tmpname2);
400 +                       free(tmpname2);
401 +                       tmpname2 = NULL;
402                 }
403  
404                 std::cout << "finished profile and profile database tests" << std::endl;
405         }
406 -       catch (libmapipp::mapi_exception e) // Catch any mapi exceptions
407 +       catch (libmapipp::mapi_exception &e) // Catch any mapi exceptions
408         {
409                 std::cout << "MAPI Exception @ main: " <<  e.what() << std::endl;
410         }
411 -       catch (std::runtime_error e) // Catch runtime exceptions
412 +       catch (std::runtime_error &e) // Catch runtime exceptions
413         {
414                 std::cout << "std::runtime_error exception @ main: " << e.what() << std::endl;
415  
416         }
417  
418 +       if (tmpname) {
419 +               unlink(tmpname);
420 +               free(tmpname);
421 +               tmpname = NULL;
422 +       }
423 +
424 +       if (tmpname2) {
425 +               unlink(tmpname2);
426 +               free(tmpname2);
427 +               tmpname2 = NULL;
428 +       }
429 +
430         return 0;
431  }
432 diff -up openchange-openchange-2.3-VULCAN/libmapi++/tests/test.cpp.covscan openchange-openchange-2.3-VULCAN/libmapi++/tests/test.cpp
433 --- openchange-openchange-2.3-VULCAN/libmapi++/tests/test.cpp.covscan   2015-05-16 17:22:04.000000000 +0200
434 +++ openchange-openchange-2.3-VULCAN/libmapi++/tests/test.cpp   2018-07-19 13:53:41.288450703 +0200
435 @@ -126,11 +126,11 @@ int main ()
436  
437                 cout << "finished session" << endl;
438         }
439 -       catch (mapi_exception e) // Catch any mapi exceptions
440 +       catch (mapi_exception &e) // Catch any mapi exceptions
441         {
442                 cout << "MAPI Exception @ main: " <<  e.what() << endl;
443         }
444 -       catch (std::runtime_error e) // Catch runtime exceptions
445 +       catch (std::runtime_error &e) // Catch runtime exceptions
446         {
447                 cout << "std::runtime_error exception @ main: " << e.what() << endl;
448  
449 diff -up openchange-openchange-2.3-VULCAN/libocpf/ocpf_api.c.covscan openchange-openchange-2.3-VULCAN/libocpf/ocpf_api.c
450 --- openchange-openchange-2.3-VULCAN/libocpf/ocpf_api.c.covscan 2015-05-16 17:22:04.000000000 +0200
451 +++ openchange-openchange-2.3-VULCAN/libocpf/ocpf_api.c 2018-07-19 13:53:41.288450703 +0200
452 @@ -316,6 +316,8 @@ int ocpf_propvalue(struct ocpf_context *
453         if (!ocpf || !ocpf->mem_ctx) return OCPF_ERROR;
454         if (!ctx) return OCPF_ERROR;
455  
456 +       memset(&lpProps, 0, sizeof(struct SPropValue));
457 +
458         switch (scope) {
459         case kw_PROPERTY:
460                 /* Sanity check: do not insert the same property twice */
461 diff -up openchange-openchange-2.3-VULCAN/libocpf/ocpf_public.c.covscan openchange-openchange-2.3-VULCAN/libocpf/ocpf_public.c
462 --- openchange-openchange-2.3-VULCAN/libocpf/ocpf_public.c.covscan      2015-05-16 17:22:04.000000000 +0200
463 +++ openchange-openchange-2.3-VULCAN/libocpf/ocpf_public.c      2018-07-19 13:53:41.288450703 +0200
464 @@ -537,6 +537,8 @@ static bool set_external_recipients(TALL
465         uint32_t                last;
466         struct SPropValue       SPropValue;
467  
468 +       memset(&SPropValue, 0, sizeof(struct SPropValue));
469 +
470         SRowSet->aRow = talloc_realloc(mem_ctx, SRowSet->aRow, struct SRow, SRowSet->cRows + 2);
471         last = SRowSet->cRows;
472         SRowSet->aRow[last].cValues = 0;
473 @@ -626,6 +628,8 @@ _PUBLIC_ enum MAPISTATUS ocpf_set_Recipi
474  
475         MAPI_RETVAL_IF(!ctx->recipients->cRows, MAPI_E_NOT_FOUND, NULL);
476  
477 +       memset(&SPropValue, 0, sizeof(struct SPropValue));
478 +
479         SPropTagArray = set_SPropTagArray(mem_ctx, 0x8,
480                                           PidTagObjectType,
481                                           PidTagDisplayName,
482 diff -up openchange-openchange-2.3-VULCAN/ndr_mapi.c.covscan openchange-openchange-2.3-VULCAN/ndr_mapi.c
483 --- openchange-openchange-2.3-VULCAN/ndr_mapi.c.covscan 2018-07-19 13:53:41.276450703 +0200
484 +++ openchange-openchange-2.3-VULCAN/ndr_mapi.c 2018-07-19 13:53:41.288450703 +0200
485 @@ -1310,8 +1310,11 @@ _PUBLIC_ enum ndr_err_code ndr_pull_EcDo
486                 NDR_PULL_ALLOC(ndr, r->out.pulTimeStamp);
487                 *r->out.pulTimeStamp = *r->in.pulTimeStamp;
488                 NDR_PULL_ALLOC(ndr, r->out.pcbAuxOut);
489 -               *r->out.pcbAuxOut = *r->in.pcbAuxOut;
490 -       }               
491 +               if (r->in.pcbAuxOut)
492 +                       *r->out.pcbAuxOut = *r->in.pcbAuxOut;
493 +               else
494 +                       *r->out.pcbAuxOut = 0;
495 +       }
496  
497         if (flags & NDR_OUT) {
498                 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
499 diff -up openchange-openchange-2.3-VULCAN/script/makepropslist.py.covscan openchange-openchange-2.3-VULCAN/script/makepropslist.py
500 --- openchange-openchange-2.3-VULCAN/script/makepropslist.py.covscan    2015-05-16 17:22:04.000000000 +0200
501 +++ openchange-openchange-2.3-VULCAN/script/makepropslist.py    2018-07-19 13:53:41.288450703 +0200
502 @@ -992,7 +992,7 @@ def check_duplicate_alternative_names():
503                                 if previous_alternative_names.has_key(altname):
504                                         print "\tIn section", entry["OXPROPS_Sect"], ", alternative name:", altname, "duplicates name in section", previous_alternative_names[altname]
505                                 if previous_canonical_names.has_key(altname):
506 -                                       print "\tIn section", entry["OXPROPS_Sect"], ", alternative name:", altname, "duplicates canonical name in section", previous_alternative_names[altname]
507 +                                       print "\tIn section", entry["OXPROPS_Sect"], ", alternative name:", altname, "duplicates canonical name in section", previous_canonical_names[altname]
508                                 previous_alternative_names[altname] = (entry["OXPROPS_Sect"])
509  
510  def check_duplicate_propids():
511 diff -up openchange-openchange-2.3-VULCAN/testprogs/test_asyncnotif.c.covscan openchange-openchange-2.3-VULCAN/testprogs/test_asyncnotif.c
512 --- openchange-openchange-2.3-VULCAN/testprogs/test_asyncnotif.c.covscan        2015-05-16 17:22:04.000000000 +0200
513 +++ openchange-openchange-2.3-VULCAN/testprogs/test_asyncnotif.c        2018-07-19 13:53:41.288450703 +0200
514 @@ -109,12 +109,16 @@ static int callback(uint16_t Notificatio
515                 break;
516         case fnevMbit|fnevObjectDeleted:
517                 OC_DEBUG(0, "[+] Message deleted");
518 +               break;
519         case fnevMbit|fnevObjectModified:
520                 OC_DEBUG(0, "[+] Message modified");
521 +               break;
522         case fnevMbit|fnevObjectMoved:
523                 OC_DEBUG(0, "[+] Message moved");
524 +               break;
525         case fnevMbit|fnevObjectCopied:
526                 OC_DEBUG(0, "[+] Message copied");
527 +               break;
528         case fnevMbit|fnevTableModified:
529                 ctable = (struct ContentsTableChange *) NotificationData;
530                 switch (ctable->TableEvent) {
531 @@ -143,6 +147,7 @@ static int callback(uint16_t Notificatio
532                 break;
533         case fnevMbit|fnevSbit|fnevObjectModified:
534                 OC_DEBUG(0, "[+] A property on a message in a search folder has changed");
535 +               break;
536         case fnevMbit|fnevSbit|fnevTableModified:
537                 stable = (struct ContentsTableChange *) NotificationData;
538                 switch (stable->TableEvent) {
539 @@ -250,6 +255,7 @@ int main(int argc, const char *argv[])
540  
541         retval = MAPIInitialize(&mapi_ctx, opt_profdb);
542         if (retval != MAPI_E_SUCCESS) {
543 +               talloc_free(mem_ctx);
544                 mapi_errstr("MAPIInitialize", retval);
545                 exit (1);
546         }
547 @@ -261,6 +267,10 @@ int main(int argc, const char *argv[])
548                 SetMAPIDebugLevel(mapi_ctx, atoi(opt_debug));
549         }
550  
551 +       mapi_object_init(&obj_store);
552 +       mapi_object_init(&obj_inbox);
553 +       mapi_object_init(&obj_contentstable);
554 +
555         /* if no profile is supplied use the default one */
556         if (!opt_profname) {
557                 retval = GetDefaultProfile(mapi_ctx, &opt_profname);
558 @@ -280,7 +290,6 @@ int main(int argc, const char *argv[])
559         }
560  
561         /* Open the default message store */
562 -       mapi_object_init(&obj_store);
563  
564         retval = OpenMsgStore(session, &obj_store);
565         if (retval != MAPI_E_SUCCESS) {
566 @@ -292,11 +301,9 @@ int main(int argc, const char *argv[])
567         retval = GetReceiveFolder(&obj_store, &fid, NULL);
568         MAPI_RETVAL_IF(retval, retval, mem_ctx);
569  
570 -       mapi_object_init(&obj_inbox);
571         retval = OpenFolder(&obj_store, fid, &obj_inbox);
572         MAPI_RETVAL_IF(retval, retval, mem_ctx);
573  
574 -       mapi_object_init(&obj_contentstable);
575         retval = GetContentsTable(&obj_inbox, &obj_contentstable, 0, &count);
576         printf("mailbox contains %i messages\n", count);
577  
578 diff -up openchange-openchange-2.3-VULCAN/utils/mapipropsdump.c.covscan openchange-openchange-2.3-VULCAN/utils/mapipropsdump.c
579 --- openchange-openchange-2.3-VULCAN/utils/mapipropsdump.c.covscan      2018-07-19 13:53:41.276450703 +0200
580 +++ openchange-openchange-2.3-VULCAN/utils/mapipropsdump.c      2018-07-19 13:53:41.289450703 +0200
581 @@ -79,21 +79,21 @@
582   */
583  
584  
585 -static const const struct ndr_interface_table *load_exchange_emsmdb_dso(const char *plugin)
586 +static const struct ndr_interface_table *load_exchange_emsmdb_dso(const char *plugin, void **phandle)
587  {
588         const struct ndr_interface_table        *p;
589 -       void                                    *handle;
590  
591 -       handle = dlopen(plugin, RTLD_NOW);
592 -       if (handle == NULL) {
593 +       *phandle = dlopen(plugin, RTLD_NOW);
594 +       if (*phandle == NULL) {
595                 printf("%s: Unable to open: %s\n", plugin, dlerror());
596                 return NULL;
597         }
598  
599 -       p = (const struct ndr_interface_table *) dlsym(handle, "ndr_table_exchange_emsmdb");
600 +       p = (const struct ndr_interface_table *) dlsym(*phandle, "ndr_table_exchange_emsmdb");
601         if (!p) {
602                 OC_DEBUG(0, "%s: Unable to find DCE/RPC interface table for 'ndr_table_exchange_emsmdb': %s", plugin, dlerror());
603 -               dlclose(handle);
604 +               dlclose(*phandle);
605 +               *phandle = NULL;
606                 return NULL;
607         }
608  
609 @@ -409,6 +409,7 @@ int main(int argc, const char *argv[])
610         struct SPropTagArray                    *s;
611         const char                              *opt_reqfile = NULL;
612         const char                              *opt_replfile = NULL;
613 +       void                                    *plhandle = NULL;
614         poptContext                             pc;
615         int                                     opt;
616         int                                     index = -1;
617 @@ -442,7 +443,7 @@ int main(int argc, const char *argv[])
618                 exit (1);
619         }
620  
621 -       p = load_exchange_emsmdb_dso(PLUGIN);
622 +       p = load_exchange_emsmdb_dso(PLUGIN, &plhandle);
623         if (!p) {
624                 exit (1);
625         }
626 @@ -454,6 +455,7 @@ int main(int argc, const char *argv[])
627         s = process_request(mem_ctx, f, opt_reqfile, &opnum, &index);
628         if (!s) {
629                 talloc_free(mem_ctx);
630 +               dlclose(plhandle);
631                 exit (1);
632         }
633  
634 @@ -461,9 +463,12 @@ int main(int argc, const char *argv[])
635         ret = process_response(mem_ctx, f, opt_replfile, s, opnum, index);
636         if (ret == -1) {
637                 talloc_free(mem_ctx);
638 +               dlclose(plhandle);
639                 exit (1);
640         }
641  
642         talloc_free(mem_ctx);
643 +       dlclose(plhandle);
644 +
645         return (0);
646  }
647 diff -up openchange-openchange-2.3-VULCAN/utils/openchangeclient.c.covscan openchange-openchange-2.3-VULCAN/utils/openchangeclient.c
648 --- openchange-openchange-2.3-VULCAN/utils/openchangeclient.c.covscan   2018-07-19 13:53:41.277450703 +0200
649 +++ openchange-openchange-2.3-VULCAN/utils/openchangeclient.c   2018-07-19 13:53:41.289450703 +0200
650 @@ -629,6 +629,8 @@ static bool set_external_recipients(TALL
651         uint32_t                last;
652         struct SPropValue       SPropValue;
653  
654 +       memset(&SPropValue, 0, sizeof(struct SPropValue));
655 +
656         SRowSet->aRow = talloc_realloc(mem_ctx, SRowSet->aRow, struct SRow, SRowSet->cRows + 1);
657         last = SRowSet->cRows;
658         SRowSet->aRow[last].cValues = 0;
659 @@ -821,6 +823,8 @@ static enum MAPISTATUS openchangeclient_
660         mapi_object_init(&obj_outbox);
661         mapi_object_init(&obj_message);
662  
663 +       memset(&SPropValue, 0, sizeof(struct SPropValue));
664 +
665         if (oclient->pf == true) {
666                 retval = openchangeclient_getpfdir(mem_ctx, obj_store, &obj_outbox, oclient->folder);
667                 if (retval != MAPI_E_SUCCESS) return retval;
This page took 0.135923 seconds and 3 git commands to generate.