Fix from Larry for glob problems.
-Erik
This commit is contained in:
parent
c5b3242d3d
commit
4aaefc2a50
6
lash.c
6
lash.c
@ -1050,10 +1050,14 @@ static int expand_arguments(char *command)
|
|||||||
* but don't overflow command which is BUFSIZ in length */
|
* but don't overflow command which is BUFSIZ in length */
|
||||||
for (i=0; i < expand_result.gl_pathc; i++) {
|
for (i=0; i < expand_result.gl_pathc; i++) {
|
||||||
length=strlen(expand_result.gl_pathv[i]);
|
length=strlen(expand_result.gl_pathv[i]);
|
||||||
if (BUFSIZ-total_length-length <= 0) {
|
if (total_length+length+1 >= BUFSIZ) {
|
||||||
error_msg(out_of_space);
|
error_msg(out_of_space);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
if (i>0) {
|
||||||
|
strcat(command+total_length, " ");
|
||||||
|
total_length+=1;
|
||||||
|
}
|
||||||
strcat(command+total_length, expand_result.gl_pathv[i]);
|
strcat(command+total_length, expand_result.gl_pathv[i]);
|
||||||
total_length+=length;
|
total_length+=length;
|
||||||
}
|
}
|
||||||
|
6
sh.c
6
sh.c
@ -1050,10 +1050,14 @@ static int expand_arguments(char *command)
|
|||||||
* but don't overflow command which is BUFSIZ in length */
|
* but don't overflow command which is BUFSIZ in length */
|
||||||
for (i=0; i < expand_result.gl_pathc; i++) {
|
for (i=0; i < expand_result.gl_pathc; i++) {
|
||||||
length=strlen(expand_result.gl_pathv[i]);
|
length=strlen(expand_result.gl_pathv[i]);
|
||||||
if (BUFSIZ-total_length-length <= 0) {
|
if (total_length+length+1 >= BUFSIZ) {
|
||||||
error_msg(out_of_space);
|
error_msg(out_of_space);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
if (i>0) {
|
||||||
|
strcat(command+total_length, " ");
|
||||||
|
total_length+=1;
|
||||||
|
}
|
||||||
strcat(command+total_length, expand_result.gl_pathv[i]);
|
strcat(command+total_length, expand_result.gl_pathv[i]);
|
||||||
total_length+=length;
|
total_length+=length;
|
||||||
}
|
}
|
||||||
|
@ -1050,10 +1050,14 @@ static int expand_arguments(char *command)
|
|||||||
* but don't overflow command which is BUFSIZ in length */
|
* but don't overflow command which is BUFSIZ in length */
|
||||||
for (i=0; i < expand_result.gl_pathc; i++) {
|
for (i=0; i < expand_result.gl_pathc; i++) {
|
||||||
length=strlen(expand_result.gl_pathv[i]);
|
length=strlen(expand_result.gl_pathv[i]);
|
||||||
if (BUFSIZ-total_length-length <= 0) {
|
if (total_length+length+1 >= BUFSIZ) {
|
||||||
error_msg(out_of_space);
|
error_msg(out_of_space);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
if (i>0) {
|
||||||
|
strcat(command+total_length, " ");
|
||||||
|
total_length+=1;
|
||||||
|
}
|
||||||
strcat(command+total_length, expand_result.gl_pathv[i]);
|
strcat(command+total_length, expand_result.gl_pathv[i]);
|
||||||
total_length+=length;
|
total_length+=length;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user