void-packages/srcpkgs/libxdg-basedir/patches/overflow-bug.patch

24 lines
834 B
Diff

From 14e000f696ef8b83264b0ca4407669bdb365fb23 Mon Sep 17 00:00:00 2001
From: Timmy Weerwag <timmy@timmyweerwag.nl>
Date: Sun, 16 Mar 2014 17:54:14 +0100
Subject: [PATCH] Overflow bug
---
src/basedir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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);
}