n = swapping ? bswap_32(idata) : (idata);\
}
-#define GET_CACHE_DATA_INT(n) \
-{ \
- n = (swapping ? (MMAP_TO_GUINT32_SWAPPED(walk_data)):(MMAP_TO_GUINT32(walk_data))); \
- walk_data += 4; rem_len -= 4; \
+#define GET_CACHE_DATA_INT(n) \
+{ \
+ if (rem_len < 4) { \
+ g_print("error at rem_len:%d\n", rem_len); \
+ error = TRUE; \
+ goto bail_err; \
+ } \
+ n = (swapping ? (MMAP_TO_GUINT32_SWAPPED(walk_data)):(MMAP_TO_GUINT32(walk_data))); \
+ walk_data += 4; rem_len -= 4; \
}
#define GET_CACHE_DATA(data, total_len) \
{ \
GET_CACHE_DATA_INT(tmp_len); \
+ if (rem_len < tmp_len) { \
+ g_print("error at rem_len:%d (tmp_len %d)\n", rem_len, tmp_len); \
+ error = TRUE; \
+ goto bail_err; \
+ } \
if ((tmp_len = msgcache_get_cache_data_str(walk_data, &data, tmp_len, conv)) < 0) { \
g_print("error at rem_len:%d\n", rem_len);\
procmsg_msginfo_free(msginfo); \
gint map_len = -1;
char *cache_data = NULL;
struct stat st;
-
+ gboolean error;
+
swapping = TRUE;
/* In case we can't open the mark file with MARK_VERSION, check if we can open it with the
}
}
}
+bail_err:
fclose(fp);
}
gint map_len = -1;
char *cache_data = NULL;
struct stat st;
-
+ gboolean error = FALSE;
+
swapping = TRUE;
/* In case we can't open the mark file with MARK_VERSION, check if we can open it with the
}
}
}
+bail_err:
fclose(fp);
}