git-svn: trunk@3366
Nigel Horne authored on 2007/11/09 00:26:14... | ... |
@@ -634,8 +634,9 @@ int cli_decode_ole_object(int fd, const char *dir) |
634 | 634 |
{ |
635 | 635 |
int ofd; |
636 | 636 |
struct stat statbuf; |
637 |
- char ch, *fullname; |
|
637 |
+ char ch; |
|
638 | 638 |
uint32_t object_size; |
639 |
+ char fullname[NAME_MAX + 1]; |
|
639 | 640 |
|
640 | 641 |
if (fstat(fd, &statbuf) == -1) { |
641 | 642 |
return -1; |
... | ... |
@@ -683,12 +684,8 @@ int cli_decode_ole_object(int fd, const char *dir) |
683 | 683 |
} |
684 | 684 |
object_size = vba_endian_convert_32(object_size, FALSE); |
685 | 685 |
} |
686 |
- fullname = cli_malloc(strlen(dir) + 18); |
|
687 |
- if(fullname == NULL) |
|
688 |
- return -1; |
|
689 |
- sprintf(fullname, "%s/_clam_ole_object", dir); |
|
686 |
+ snprintf(fullname, sizeof(fullname) - 1, "%s/_clam_ole_object", dir); |
|
690 | 687 |
ofd = open(fullname, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, 0600); |
691 |
- free(fullname); |
|
692 | 688 |
if (ofd < 0) { |
693 | 689 |
return -1; |
694 | 690 |
} |
... | ... |
@@ -923,26 +920,6 @@ typedef struct macro_info_tag { |
923 | 923 |
struct macro_entry_tag *macro_entry; |
924 | 924 |
} macro_info_t; |
925 | 925 |
|
926 |
-typedef struct menu_entry_tag { |
|
927 |
- uint16_t context; |
|
928 |
- uint16_t menu; |
|
929 |
- uint16_t extname_i; |
|
930 |
- uint16_t unknown; |
|
931 |
- uint16_t intname_i; |
|
932 |
- uint16_t pos; |
|
933 |
-} menu_entry_t; |
|
934 |
- |
|
935 |
-typedef struct mac_token_tag { |
|
936 |
- unsigned char token; |
|
937 |
- unsigned char *str; |
|
938 |
-} mac_token_t; |
|
939 |
- |
|
940 |
-typedef struct mac_token2_tag { |
|
941 |
- uint16_t token; |
|
942 |
- unsigned char *str; |
|
943 |
- |
|
944 |
-} mac_token2_t; |
|
945 |
- |
|
946 | 926 |
static void wm_free_macro_info(macro_info_t *macro_info); |
947 | 927 |
|
948 | 928 |
static void wm_print_fib(mso_fib_t *fib) |
... | ... |
@@ -1207,7 +1184,7 @@ wm_skip_macro_intnames(int fd) |
1207 | 1207 |
|
1208 | 1208 |
vba_project_t *wm_dir_read(const char *dir) |
1209 | 1209 |
{ |
1210 |
- int fd, done, i; |
|
1210 |
+ int fd, done; |
|
1211 | 1211 |
off_t end_offset; |
1212 | 1212 |
unsigned char info_id; |
1213 | 1213 |
macro_info_t *macro_info=NULL; |
... | ... |
@@ -1334,6 +1311,8 @@ vba_project_t *wm_dir_read(const char *dir) |
1334 | 1334 |
free(vba_project); |
1335 | 1335 |
vba_project = NULL; |
1336 | 1336 |
} else { |
1337 |
+ int i; |
|
1338 |
+ |
|
1337 | 1339 |
vba_project->count = macro_info->count; |
1338 | 1340 |
for(i = 0; i < macro_info->count; i++) { |
1339 | 1341 |
vba_project->name[i] = cli_strdup("WordDocument"); |
... | ... |
@@ -1342,13 +1321,12 @@ vba_project_t *wm_dir_read(const char *dir) |
1342 | 1342 |
vba_project->key[i] = macro_info->macro_entry[i].key; |
1343 | 1343 |
} |
1344 | 1344 |
} |
1345 |
+abort: |
|
1346 |
+ wm_free_macro_info(macro_info); |
|
1347 |
+ /* Fall through */ |
|
1345 | 1348 |
} else |
1346 | 1349 |
vba_project = NULL; |
1347 | 1350 |
|
1348 |
- /* Fall through */ |
|
1349 |
-abort: |
|
1350 |
- if (macro_info) |
|
1351 |
- wm_free_macro_info(macro_info); |
|
1352 | 1351 |
return vba_project; |
1353 | 1352 |
} |
1354 | 1353 |
|