[libbluray-devel] Fix alloc size

hpi1 git at videolan.org
Sun Aug 21 15:06:49 CEST 2016


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sun Aug 21 15:47:51 2016 +0300| [9b6194088f22119c10fb9b5bc494d2ede12008a8] | committer: hpi1

Fix alloc size

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=9b6194088f22119c10fb9b5bc494d2ede12008a8
---

 src/devtools/mpls_dump.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/devtools/mpls_dump.c b/src/devtools/mpls_dump.c
index 547b947..2db25d1 100644
--- a/src/devtools/mpls_dump.c
+++ b/src/devtools/mpls_dump.c
@@ -769,7 +769,10 @@ main(int argc, char *argv[])
             struct dirent *ent;
             int jj = 0;
             for (ent = readdir(dir); ent != NULL; ent = readdir(dir)) {
-                dirlist[jj++] = strcpy((char*)malloc(strlen(ent->d_name)), ent->d_name);
+                char *s = (char*)malloc(strlen(ent->d_name) + 1);
+                if (s) {
+                    dirlist[jj++] = strcpy(s, ent->d_name);
+                }
             }
             qsort(dirlist, jj, sizeof(char*), _qsort_str_cmp);
             for (jj = 0; dirlist[jj] != NULL && pl_ii < 1000; jj++) {



More information about the libbluray-devel mailing list