1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

out of memory checks: add missing sh_getcwd() wrapper (re: 7ad274f8)

getcwd() with 0/NULL arguments also mallocs, so needs a check.
This commit is contained in:
Martijn Dekker 2021-12-05 22:00:08 +01:00
parent f6a6d236f1
commit a3f4b5efd1
3 changed files with 10 additions and 1 deletions

View file

@ -262,7 +262,7 @@ char *path_pwd(Shell_t *shp,int flag)
if(!(cp && *cp=='/' && test_inode(cp,e_dot)))
{
/* Get physical PWD (no symlinks) using getcwd(3), fall back to "." */
cp = getcwd(NIL(char*),0);
cp = sh_getcwd();
if(!cp)
return((char*)e_dot);
tofree++;