|
@@ -221,6 +221,11 @@ int sys_execv(const char * program, userptr_t args)
|
|
|
for (int i = 0; i < argcount; ++i)
|
|
|
{
|
|
|
char * useraddr = kmalloc(sizeof(temp));
|
|
|
+ if (!(useraddr))
|
|
|
+ {
|
|
|
+ kfree(argv);
|
|
|
+ return ENOMEM;
|
|
|
+ }
|
|
|
// useraddr is now the address of the string in userland
|
|
|
errcode = copyin(temp, useraddr, sizeof(temp));
|
|
|
if (errcode)
|
|
@@ -230,6 +235,7 @@ int sys_execv(const char * program, userptr_t args)
|
|
|
}
|
|
|
// change argv[i] to be a string of length enough
|
|
|
int strLen = strlen(*(char **)useraddr) + 1;
|
|
|
+ kfree(useraddr);
|
|
|
size_t wasteOfSpace;
|
|
|
argv[i] = kmalloc(strLen * sizeof(char));
|
|
|
if (!(argv[i]))
|