aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2015-01-25 00:00:40 -0400
committerJoey Hess <joeyh@joeyh.name>2015-01-25 00:00:40 -0400
commitfe0eaf1870d3b992ef3caa8c49c3b22e965ac36b (patch)
tree99872f8d139d91060e1018788a702012828c6fb3 /IkiWiki
parent8c35714a37095c720308478660001a5fd9db5bfc (diff)
downloadikiwiki-fe0eaf1870d3b992ef3caa8c49c3b22e965ac36b.tar
ikiwiki-fe0eaf1870d3b992ef3caa8c49c3b22e965ac36b.tar.gz
Fix NULL ptr deref on ENOMOM in wrapper. (Thanks, igli)
Probably not exploitable, but who knows..
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Wrapper.pm15
1 files changed, 11 insertions, 4 deletions
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) {