# HG changeset patch # User ben # Date 1212695176 0 # Node ID 805f7deb1b48eaea56b1c29e9d8e7fb0a6c5095e # Parent bab42914ea63256b3a8c348163710fe2cc3b4268 Ensure 'path' string is 0 terminated. Patch by Guillaume Lecerf diff -r bab42914ea63 -r 805f7deb1b48 libmenu/menu_filesel.c --- a/libmenu/menu_filesel.c Wed Jun 04 20:15:04 2008 +0000 +++ b/libmenu/menu_filesel.c Thu Jun 05 19:46:16 2008 +0000 @@ -410,10 +410,10 @@ if (path_fp >= 0) { if (!fstat (path_fp, &st) && (st.st_size > 0)) { path = malloc(st.st_size+1); + path[st.st_size] = '\0'; if ((read(path_fp, path, st.st_size) == st.st_size) && path[0] == '/' && !stat(path, &st) && S_ISDIR(st.st_mode)){ freepath = path; - path[st.st_size] = '\0'; } else { free(path);