Lines 150-160
Link Here
|
150 |
{ |
150 |
{ |
151 |
LISTCELLPTR next, cell; |
151 |
LISTCELLPTR next, cell; |
152 |
int len; |
152 |
int len; |
153 |
int slen, slen_rest; |
153 |
int slen; |
154 |
char *result; |
154 |
char *result; |
155 |
char *p, *tpath; |
155 |
char *p, *tpath; |
156 |
|
156 |
|
157 |
if( (slen_rest = slen = s->len) == 0) |
157 |
if( (slen = s->len) == 0) |
158 |
return(NIL(char)); |
158 |
return(NIL(char)); |
159 |
|
159 |
|
160 |
/* reserve enough space to hold the concated original filenames. */ |
160 |
/* reserve enough space to hold the concated original filenames. */ |
Lines 175-194
Link Here
|
175 |
/* ... but only if DO_WINPATH() did something. */ |
175 |
/* ... but only if DO_WINPATH() did something. */ |
176 |
len = strlen(tpath); |
176 |
len = strlen(tpath); |
177 |
|
177 |
|
178 |
if( len > slen_rest ) { |
178 |
if( len > cell->len ) { |
179 |
/* We need more memory. As DOS paths are usually shorter than the |
179 |
/* We need more memory. As DOS paths are usually shorter than the |
180 |
* original cygwin POSIX paths (exception mounted paths) this should |
180 |
* original cygwin POSIX paths (exception mounted paths) this should |
181 |
* rarely happen. */ |
181 |
* rarely happen. */ |
182 |
int p_offset = p - result; |
182 |
int p_offset = p - result; |
183 |
/* Get more than needed. */ |
183 |
slen += (len-cell->len) + 1; |
184 |
slen += slen + len-slen_rest + 128; |
184 |
if((result = realloc( result, slen ) ) == NULL) |
185 |
if((result = realloc( result, (unsigned)(slen*sizeof(char)) ) ) == NULL) |
|
|
186 |
No_ram(); |
185 |
No_ram(); |
187 |
p = result + p_offset; |
186 |
p = result + p_offset; |
188 |
} |
187 |
} |
189 |
} |
188 |
} |
190 |
|
|
|
191 |
slen_rest -= len; |
192 |
#endif |
189 |
#endif |
193 |
|
190 |
|
194 |
memcpy((void *)p, (void *)tpath, len); |
191 |
memcpy((void *)p, (void *)tpath, len); |