From 7715144e7d55b2854f907001c432348e4caa5954 Mon Sep 17 00:00:00 2001 From: Charles Manning Date: Wed, 13 Apr 2011 10:20:06 +1200 Subject: [PATCH 1/1] yaffs: Handle attribute size query correctly. If getxattr() is passed a buffer size of zero then this is a size query. Return the size of the attribute without copying it out. Signed-off-by: Charles Manning --- yaffs_nameval.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/yaffs_nameval.c b/yaffs_nameval.c index e75411b..487b03e 100644 --- a/yaffs_nameval.c +++ b/yaffs_nameval.c @@ -146,6 +146,12 @@ int nval_get(const char *xb, int xb_size, const YCHAR * name, char *buf, pos++; size--; + /* If bsize is zero then this is a size query. + * Return the size, but don't copy. + */ + if (!bsize) + return size; + if (size <= bsize) { memcpy(buf, xb + pos, size); return size; -- 2.30.2