Fix some potential segfaults on amd64 as well as misuse of APIs with respect

to their counterparts on Linux.

Submitted by:   Sean Fagan <sef@ixsystems.com>
This commit is contained in:
Joe Marcus Clarke 2014-05-27 16:41:50 +00:00
parent f2cadc19f9
commit 6cb2eeaa5c
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=355543
3 changed files with 24 additions and 4 deletions

View file

@ -3,7 +3,7 @@
PORTNAME= netatalk
PORTVERSION= 3.1.1
PORTREVISION= 1
PORTREVISION= 2
PORTEPOCH= 1
CATEGORIES= net
MASTER_SITES= SF

View file

@ -0,0 +1,11 @@
--- libatalk/adouble/ad_open.c.orig 2014-05-27 12:33:15.000000000 -0400
+++ libatalk/adouble/ad_open.c 2014-05-27 12:34:00.000000000 -0400
@@ -586,7 +586,7 @@ static int ad_convert_osx(const char *pa
origlen = ad_getentryoff(ad, ADEID_RFORK) + ad_getentrylen(ad, ADEID_RFORK);
- map = mmap(NULL, origlen, PROT_WRITE, MAP_SHARED, ad_reso_fileno(ad), 0);
+ map = mmap(NULL, origlen, PROT_READ | PROT_WRITE, MAP_SHARED, ad_reso_fileno(ad), 0);
if (map == MAP_FAILED) {
LOG(log_error, logtype_ad, "mmap AppleDouble: %s\n", strerror(errno));
EC_FAIL;

View file

@ -1,6 +1,15 @@
--- libatalk/vfs/extattr.c.orig 2014-05-09 13:42:40.000000000 -0400
+++ libatalk/vfs/extattr.c 2014-05-09 13:45:39.000000000 -0400
@@ -241,6 +241,10 @@ ssize_t sys_lgetxattr (const char *path,
--- libatalk/vfs/extattr.c.orig 2013-10-18 07:57:33.000000000 -0400
+++ libatalk/vfs/extattr.c 2014-05-27 12:31:57.000000000 -0400
@@ -193,6 +193,8 @@ ssize_t sys_fgetxattr (int filedes, cons
const char *attrname = ((s=strchr(name, '.')) == NULL) ? name : s + 1;
if((retval=extattr_get_fd(filedes, attrnamespace, attrname, NULL, 0)) >= 0) {
+ if (size == 0)
+ return retval;
if(retval > size) {
errno = ERANGE;
return -1;
@@ -241,6 +243,10 @@ ssize_t sys_lgetxattr (const char *path,
#elif defined(HAVE_EXTATTR_GET_LINK)
ssize_t retval;
if((retval=extattr_get_link(path, EXTATTR_NAMESPACE_USER, uname, NULL, 0)) >= 0) {