From 07c199101203b0c1a49edc432f1e64e5010884b2 Mon Sep 17 00:00:00 2001 From: Zachary Loafman Date: Wed, 12 May 2010 21:25:05 +0000 Subject: [PATCH] extattr: Fix a signed/unsigned issue Submitted by: Matthew Fleming Reviewed by: zml, dfr --- usr.sbin/extattr/rmextattr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/usr.sbin/extattr/rmextattr.c b/usr.sbin/extattr/rmextattr.c index 7ed92b6e9650..db7df1a321c1 100644 --- a/usr.sbin/extattr/rmextattr.c +++ b/usr.sbin/extattr/rmextattr.c @@ -231,9 +231,12 @@ main(int argc, char *argv[]) break; if (!flag_quiet) printf("%s\t", argv[arg_counter]); - for (i = 0; i < error; i += buf[i] + 1) + for (i = 0; i < error; i += ch + 1) { + /* The attribute name length is unsigned. */ + ch = (unsigned char)buf[i]; printf("%s%*.*s", i ? "\t" : "", - buf[i], buf[i], buf + i + 1); + ch, ch, buf + i + 1); + } printf("\n"); continue; case EAGET: