wmem_array_index() returns a *pointer* to the array element.
authorGuy Harris <guy@alum.mit.edu>
Mon, 22 Aug 2016 07:37:42 +0000 (00:37 -0700)
committerGuy Harris <guy@alum.mit.edu>
Mon, 22 Aug 2016 07:38:15 +0000 (07:38 +0000)
The array is an array of guint8 *'s that point to strings;
wmem_array_index() doesn't return a pointer to the string, it returns a
pointer to a pointer to the string, and you have to dereference the
result of the wmem_array_index() call to get a pointer to the string.

Change-Id: I8c7b3320f0979b01383ad255419c21cdeb7df4c7
Reviewed-on: https://code.wireshark.org/review/17221
Reviewed-by: Guy Harris <guy@alum.mit.edu>
epan/dissectors/packet-pcp.c

index 9c742f176a53da693e96f30a9d67c6adb5bab032..5beaed5a8ec4635244e18fa8d9809d77f46dcbc4 100644 (file)
@@ -617,7 +617,7 @@ static void create_pmid_to_name_map_from_candidates(pcp_conv_info_t *pcp_conv_in
         guint8 *pmid_name;
 
         pmid = tvb_get_ntohl(tvb, offset);
-        pmid_name = (guint8 *)wmem_array_index(pcp_conv_info->pmid_name_candidates, i);
+        pmid_name = *(guint8 **)wmem_array_index(pcp_conv_info->pmid_name_candidates, i);
 
         if(wmem_map_lookup(pcp_conv_info->pmid_to_name, GINT_TO_POINTER(pmid)) == NULL) {
             wmem_map_insert(pcp_conv_info->pmid_to_name, GINT_TO_POINTER(pmid), pmid_name);