Skip to content

Commit

Permalink
[cli] Ensure that probed libstdc++ path is NULL-terminated
Browse files Browse the repository at this point in the history
It appears that we were assuming our path was initialized with zeros, but that is not a safe assumption.
  • Loading branch information
staticfloat committed May 18, 2023
1 parent ce3909c commit 7111597
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cli/loader_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ static char *libstdcxxprobe(void)
free(path);
return NULL;
}
// Ensure that `path` is zero-terminated.
path[pathlen] = '\0';
return path;
}
}
Expand Down

0 comments on commit 7111597

Please sign in to comment.