Skip to content

Commit 8ff4b67

Browse files
committed
Argh!!! I guess nobody has ever looked at this code.
1 parent 14aa0e7 commit 8ff4b67

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

TODO_SEGFAULTS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ Fixed:
77
i18n_convert/mb_convert_encoding (Moriyoshi Koizumi)
88
socket_iovec_alloc (Rasmus)
99
exif_imagetype,exif_thumbnail (Rasmus)
10+
dbase_open (Rasmus)
1011

1112

1213
Open:
1314

1415
array_pad
1516
bcsub (1)
16-
dbase_open
1717
mb_ereg (2)
1818
mb_ereg_match (2)
1919
mb_eregi (2)

ext/dbase/dbf_head.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,10 @@ dbhead_t *dbf_open(char *dp, int o_flags TSRMLS_DC)
247247

248248
cp = dp;
249249
if ((fd = VCWD_OPEN(cp, o_flags|O_BINARY)) < 0) {
250-
cp = (char *)malloc(256);
251-
strcpy(cp, dp); strcat(cp, ".dbf");
250+
cp = (char *)malloc(MAXPATHLEN); /* So where does this get free()'d? -RL */
251+
strncpy(cp, dp, MAXPATHLEN-5); strcat(cp, ".dbf");
252252
if ((fd = VCWD_OPEN(cp, o_flags)) < 0) {
253+
free(cp);
253254
perror("open");
254255
return NULL;
255256
}

0 commit comments

Comments
 (0)