From: Joey Hess Date: Sun, 25 Jan 2015 04:00:40 +0000 (-0400) Subject: Fix NULL ptr deref on ENOMOM in wrapper. (Thanks, igli) X-Git-Tag: debian/3.20150329~118 X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/fe0eaf1870d3b992ef3caa8c49c3b22e965ac36b?ds=sidebyside Fix NULL ptr deref on ENOMOM in wrapper. (Thanks, igli) Probably not exploitable, but who knows.. --- diff --git a/IkiWiki/Wrapper.pm b/IkiWiki/Wrapper.pm index 4c99cdaa0..583841d6c 100644 --- a/IkiWiki/Wrapper.pm +++ b/IkiWiki/Wrapper.pm @@ -189,16 +189,23 @@ int i=0; void addenv(char *var, char *val) { char *s=malloc(strlen(var)+1+strlen(val)+1); - if (!s) + if (!s) { perror("malloc"); - sprintf(s, "%s=%s", var, val); - newenviron[i++]=s; + exit(1); + } + else { + sprintf(s, "%s=%s", var, val); + newenviron[i++]=s; + } } void set_cgilock_fd (int lockfd) { char *fd_s=malloc(8); sprintf(fd_s, "%i", lockfd); - setenv("IKIWIKI_CGILOCK_FD", fd_s, 1); + if (setenv("IKIWIKI_CGILOCK_FD", fd_s, 1) != 0) { + perror("setenv"); + exit(1); + } } int main (int argc, char **argv) { diff --git a/debian/changelog b/debian/changelog index 89e587737..6ca649854 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ikiwiki (3.20150108) UNRELEASED; urgency=medium + + * Fix NULL ptr deref on ENOMOM in wrapper. (Thanks, igli) + + -- Joey Hess Sat, 24 Jan 2015 23:59:20 -0400 + ikiwiki (3.20150107) experimental; urgency=medium [ Joey Hess ]