Permalink
Browse files

Fix segfault when calling AppRun from outside the AppDir by using an …

…absolute path
  • Loading branch information...
1 parent 8840db5 commit a49019dd6813298364554cb2d673f9a0be6e79f9 @probonopd committed Oct 23, 2016
Showing with 4 additions and 1 deletion.
  1. +4 −1 AppRun.c
View
@@ -69,7 +69,9 @@ int main(int argc, char *argv[])
/* Extract executable from .desktop file */
FILE *f;
- f = fopen(namelist[0]->d_name, "r");
+ char *desktop_file = malloc(LINE_SIZE);
+ snprintf(desktop_file, LINE_SIZE-1, "%s/%s", appdir, namelist[0]->d_name);
+ f = fopen(desktop_file, "r");
char *line = malloc(LINE_SIZE);
unsigned int n = LINE_SIZE;
@@ -148,5 +150,6 @@ int main(int argc, char *argv[])
die("Error executing '%s'; return code: %d\n", executable, ret);
free(line);
+ free(desktop_file);
return 0;
}

0 comments on commit a49019d

Please sign in to comment.