Mercurial > libpst
comparison src/libpst.c @ 341:c638905665bc
Daniel Gryniewicz found buffer overrun in LIST_COPY_TIME
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Fri, 27 Dec 2013 08:42:41 -0800 |
parents | 0f3185217313 |
children | 5d0dc4db45b3 |
comparison
equal
deleted
inserted
replaced
340:0f3185217313 | 341:c638905665bc |
---|---|
2062 LIST_COPY_STR(label, targ); \ | 2062 LIST_COPY_STR(label, targ); \ |
2063 } | 2063 } |
2064 | 2064 |
2065 // malloc space and copy the item filetime | 2065 // malloc space and copy the item filetime |
2066 #define LIST_COPY_TIME(label, targ) { \ | 2066 #define LIST_COPY_TIME(label, targ) { \ |
2067 if (list->elements[x]->type != 0x40) { \ | 2067 if ((list->elements[x]->type != 0x40) || \ |
2068 DEBUG_WARN(("src not 0x40 for filetime dst\n")); \ | 2068 (list->elements[x]->size != sizeof(FILETIME)) { \ |
2069 DEBUG_WARN(("src not 0x40 or wrong length for filetime dst\n")); \ | |
2069 DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); \ | 2070 DEBUG_HEXDUMP(list->elements[x]->data, list->elements[x]->size); \ |
2070 } \ | 2071 } \ |
2071 else { \ | 2072 else { \ |
2072 targ = (FILETIME*) pst_realloc(targ, sizeof(FILETIME)); \ | 2073 targ = (FILETIME*) pst_realloc(targ, sizeof(FILETIME)); \ |
2073 memcpy(targ, list->elements[x]->data, min(sizeof(FILETIME), list->elements[x]->size)); \ | 2074 memcpy(targ, list->elements[x]->data, sizeof(FILETIME)); \ |
2074 LE32_CPU(targ->dwLowDateTime); \ | 2075 LE32_CPU(targ->dwLowDateTime); \ |
2075 LE32_CPU(targ->dwHighDateTime); \ | 2076 LE32_CPU(targ->dwHighDateTime); \ |
2076 DEBUG_INFO((label" - %s", pst_fileTimeToAscii(targ, time_buffer))); \ | 2077 DEBUG_INFO((label" - %s", pst_fileTimeToAscii(targ, time_buffer))); \ |
2077 } \ | 2078 } \ |
2078 } | 2079 } |