libxdg-basedir/libxdg-basedir-basedir-bounds-error.patch
2019-02-12 09:21:48 -06:00

14 lines
575 B
Diff

diff --git a/src/basedir.c b/src/basedir.c
index 68ab879..1a2a8c4 100644
--- a/src/basedir.c
+++ b/src/basedir.c
@@ -574,7 +574,7 @@ static char * xdgGetRelativeHome(const char *envname, const char *relativefallba
unsigned int homelen;
if (!(home = xdgGetEnv("HOME")))
return NULL;
- if (!(relhome = (char*)malloc((homelen = strlen(home))+fallbacklength))) return NULL;
+ if (!(relhome = (char*)malloc((homelen = strlen(home))+fallbacklength+1))) return NULL;
memcpy(relhome, home, homelen);
memcpy(relhome+homelen, relativefallback, fallbacklength+1);
}