Patch from Reiner Bezuidenhout <rbezuide@yahoo.com>:
authorJulien Kerihuel <j.kerihuel@openchange.org>
Tue, 19 Oct 2010 14:41:27 +0000 (14:41 +0000)
committerJulien Kerihuel <j.kerihuel@openchange.org>
Tue, 19 Oct 2010 14:41:27 +0000 (14:41 +0000)
Fix invalid counter use within get_MAPITAGS_SRow with
an additional actual_count parameter

libmapi/IMessage.c
libmapi/libmapi_private.h
libmapi/property.c

index cb46732d241d44d649bdae929b5dc87a4e78202d..17c86eeba6fa2beb4e1ccef00ad5b66c713f3635 100644 (file)
@@ -728,8 +728,7 @@ _PUBLIC_ enum MAPISTATUS ModifyRecipients(mapi_object_t *obj_message,
         * append here property tags that can be fetched with
         * ResolveNames but shouldn't be included in ModifyRecipients rows
         */
-       request.properties = get_MAPITAGS_SRow(mem_ctx, &SRowSet->aRow[0]);
-       count = SRowSet->aRow[0].cValues - 1;
+       request.properties = get_MAPITAGS_SRow(mem_ctx, &SRowSet->aRow[0], &count);
        request.prop_count = MAPITAGS_delete_entries(request.properties, count, 17,
                                                     PR_ENTRYID,
                                                     PR_DISPLAY_NAME,
index 7a0252894be7c2f678907bb1976af87eb0fba9c6..6822cb3e0466c0526141c1ced4b1f75962f9ccfe 100644 (file)
@@ -106,7 +106,7 @@ void                        mapi_object_table_init(TALLOC_CTX *, mapi_object_t *);
 enum MAPISTATUS                mapi_object_bookmark_find(mapi_object_t *, uint32_t,struct SBinary_short *);
 
 /* The following private definitions come from libmapi/property.c */
-enum MAPITAGS          *get_MAPITAGS_SRow(TALLOC_CTX *, struct SRow *);
+enum MAPITAGS          *get_MAPITAGS_SRow(TALLOC_CTX *, struct SRow *, uint32_t *);
 uint32_t               MAPITAGS_delete_entries(enum MAPITAGS *, uint32_t, uint32_t, ...);
 size_t                 get_utf8_utf16_conv_length(const char *);
 
index 7aa1b95077811f88328ba86e8fefe0edf7a022a0..c0bfc3d89a8e8c9a51fdcc98d68742b1b22e95b5 100644 (file)
@@ -183,7 +183,9 @@ _PUBLIC_ const void *get_SPropValue_SRow_data(struct SRow *aRow,
   Create a MAPITAGS array from a SRow entry
  */
 
-enum MAPITAGS *get_MAPITAGS_SRow(TALLOC_CTX *mem_ctx, struct SRow *aRow)
+enum MAPITAGS *get_MAPITAGS_SRow(TALLOC_CTX *mem_ctx, 
+                                struct SRow *aRow, 
+                                uint32_t *actual_count)
 {
        enum MAPITAGS   *mapitags;
        uint32_t        count, idx;
@@ -197,6 +199,8 @@ enum MAPITAGS *get_MAPITAGS_SRow(TALLOC_CTX *mem_ctx, struct SRow *aRow)
                }
        }
        mapitags[idx] = 0;
+       *actual_count = idx;
+
        return mapitags;
 }