From 724c0203811e5cb7872fc4ee4089115f58b32705 Mon Sep 17 00:00:00 2001 From: didg Date: Mon, 18 Sep 2006 09:22:25 +0000 Subject: [PATCH] limit comments size to 128 bytes, cf. Adobe CS2 bug --- etc/afpd/desktop.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/etc/afpd/desktop.c b/etc/afpd/desktop.c index 9acc3797..91db9151 100644 --- a/etc/afpd/desktop.c +++ b/etc/afpd/desktop.c @@ -1,5 +1,5 @@ /* - * $Id: desktop.c,v 1.34 2006-09-17 17:48:15 didg Exp $ + * $Id: desktop.c,v 1.35 2006-09-18 09:22:25 didg Exp $ * * See COPYRIGHT. * @@ -811,7 +811,7 @@ static int ad_getcomment(struct vol *vol, struct path *path, char *rbuf, int *rb struct ofork *of; char *upath; int isadir; - + int clen; upath = path->u_name; isadir = path_isadir(path); @@ -838,9 +838,10 @@ static int ad_getcomment(struct vol *vol, struct path *path, char *rbuf, int *rb return( AFPERR_NOITEM ); } - *rbuf++ = ad_getentrylen( adp, ADEID_COMMENT ); - memcpy( rbuf, ad_entry( adp, ADEID_COMMENT ), ad_getentrylen( adp, ADEID_COMMENT )); - *rbuflen = ad_getentrylen( adp, ADEID_COMMENT ) + 1; + clen = min( ad_getentrylen( adp, ADEID_COMMENT ), 128 ); /* OSX only use 128, greater kill Adobe CS2 */ + *rbuf++ = clen; + memcpy( rbuf, ad_entry( adp, ADEID_COMMENT ), clen); + *rbuflen = clen + 1; ad_close_metadata( adp); return( AFP_OK ); -- 2.39.2