fix a kernel clobberer that showed up when running gcc. Was able to successfully build a hello world app with gcc after this.

The kernel arg logic was faulty, and wasn't using strlcpy properly (which returns the size of the src string, not the remaining size). Replaced it with a simpler, but less efficient series of strlcat()s.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20162 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Travis Geiselbrecht 2007-02-19 06:57:38 +00:00
parent 1cbf8f4b3c
commit 040e5e50f1
1 changed files with 4 additions and 17 deletions

View File

@ -777,23 +777,10 @@ team_create_thread_start(void *args)
TRACE(("team_create_thread_start: loading elf binary '%s'\n", path)); TRACE(("team_create_thread_start: loading elf binary '%s'\n", path));
// add args to info member // add args to info member
sizeLeft = strlcpy(team->args, path, sizeof(team->args)); team->args[0] = 0;
udest = team->args + sizeLeft; for (i = 1; i < argCount; i++) {
sizeLeft = sizeof(team->args) - sizeLeft; strlcat(team->args, " ", sizeof(team->args));
strlcat(team->args, teamArgs->args[i], sizeof(team->args));
for (i = 1; i < argCount && sizeLeft > 2; i++) {
size_t length;
udest[0] = ' ';
udest++;
sizeLeft--;
length = strlcpy(udest, teamArgs->args[i], sizeLeft);
if (length >= sizeLeft)
break;
sizeLeft -= length;
udest += length;
} }
free_team_arg(teamArgs); free_team_arg(teamArgs);