|
@@ -250,7 +250,7 @@ int sys_execv(const char * program, userptr_t args)
|
|
|
}
|
|
|
|
|
|
// allocate space for filepath
|
|
|
- char * filepath = kmalloc(sizeof(program));
|
|
|
+ char * filepath = kmalloc((strlen(program) + 1) * sizeof(char));
|
|
|
if (!(filepath))
|
|
|
{
|
|
|
freeArgv(argv, argcount - 1);
|
|
@@ -259,23 +259,8 @@ int sys_execv(const char * program, userptr_t args)
|
|
|
}
|
|
|
|
|
|
// get kernel copy of filepath
|
|
|
- //size_t useless;
|
|
|
-
|
|
|
- for (int i = 0; i < argcount; ++i)
|
|
|
- {
|
|
|
- kprintf("arg: %d\n", strlen(argv[i]));
|
|
|
- }
|
|
|
-
|
|
|
size_t useless;
|
|
|
errcode = copyinstr((const_userptr_t)program, filepath, strlen(program) + 1, &useless);
|
|
|
-
|
|
|
- for (int i = 0; i < argcount; ++i)
|
|
|
- {
|
|
|
- kprintf("arg: %d\n", strlen(argv[i]));
|
|
|
- }
|
|
|
-
|
|
|
- // moving this part of the code (getting filepath) to the top did not make the problem go away, instead it gave me a malloc error trying to allocate argv
|
|
|
-
|
|
|
if (errcode)
|
|
|
{
|
|
|
freeArgv(argv, argcount - 1);
|