Fix NULL ptr deref on ENOMOM in wrapper. (Thanks, igli)

Probably not exploitable, but who knows..
master
Joey Hess 2015-01-25 00:00:40 -04:00
parent 8c35714a37
commit fe0eaf1870
2 changed files with 17 additions and 4 deletions

View File

@ -189,16 +189,23 @@ int i=0;
void addenv(char *var, char *val) { void addenv(char *var, char *val) {
char *s=malloc(strlen(var)+1+strlen(val)+1); char *s=malloc(strlen(var)+1+strlen(val)+1);
if (!s) if (!s) {
perror("malloc"); perror("malloc");
sprintf(s, "%s=%s", var, val); exit(1);
newenviron[i++]=s; }
else {
sprintf(s, "%s=%s", var, val);
newenviron[i++]=s;
}
} }
void set_cgilock_fd (int lockfd) { void set_cgilock_fd (int lockfd) {
char *fd_s=malloc(8); char *fd_s=malloc(8);
sprintf(fd_s, "%i", lockfd); 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) { int main (int argc, char **argv) {

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
ikiwiki (3.20150108) UNRELEASED; urgency=medium
* Fix NULL ptr deref on ENOMOM in wrapper. (Thanks, igli)
-- Joey Hess <id@joeyh.name> Sat, 24 Jan 2015 23:59:20 -0400
ikiwiki (3.20150107) experimental; urgency=medium ikiwiki (3.20150107) experimental; urgency=medium
[ Joey Hess ] [ Joey Hess ]