Commit 287e8309 authored by npzacs's avatar npzacs Committed by Ano Nymous
Browse files

Fixed segfault when mount point path can't be resolved

parent ca77cc7f
????-??-??:
- Fixed segfault when mount point path can't be resolved
- Do not export internal symbols from generated parser/lexer
- Do not distribute generated parser files
- Check for libgpg-error. Link against it when needed.
......
......@@ -91,7 +91,7 @@ AC_TYPE_SIGNAL
# required headers
AC_CHECK_HEADERS([stdarg.h sys/types.h dirent.h errno.h libgen.h malloc.h])
AC_CHECK_HEADERS([stdlib.h mntent.h linux/cdrom.h inttypes.h])
AC_CHECK_HEADERS([sys/time.h time.h sys/select.h])
AC_CHECK_HEADERS([sys/time.h time.h sys/select.h limits.h])
# required structures
AC_STRUCT_DIRENT_D_TYPE
......
......@@ -37,6 +37,10 @@
#include <mntent.h>
#endif
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#ifdef HAVE_LINUX_CDROM_H
#include <sys/ioctl.h>
#include <linux/cdrom.h>
......@@ -384,7 +388,13 @@ MMC *mmc_open(const char *path)
#if defined(HAVE_MNTENT_H)
#ifdef HAVE_REALPATH
char *file_path = realpath(path, NULL);
char *file_path = malloc(PATH_MAX);
if (!file_path || !realpath(path, file_path)) {
DEBUG(DBG_MMC, "Failed resolving path %s (%p)\n", path, mmc);
X_FREE(mmc);
X_FREE(file_path);
return NULL;
}
#else
char *file_path = (char*)malloc(strlen(path) + 1);
strcpy(file_path, path);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment