diff --git a/ChangeLog b/ChangeLog index f0035ca..8044a7f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-01-29 Niels Grewe + + * Source/DKMethod.m: Fix off-by-one error when unmarshalling + multiple return values. + 2014-01-29 Niels Grewe * Documentation/UsingDBus.texi: Document how diff --git a/Source/DKMethod.m b/Source/DKMethod.m index af29b0c..1839e2e 100644 --- a/Source/DKMethod.m +++ b/Source/DKMethod.m @@ -563,11 +563,13 @@ * Proceed to the next value in the message, but raise an exception if * we are missing some. */ - if (NO == (BOOL)dbus_message_iter_next(iter)) + if ((NO == (BOOL)dbus_message_iter_next(iter)) + && (numArgs > (index + 1))) { + DKArgument *nextArg = [outArgs objectAtIndex: index + 1]; [NSException raise: @"DKMethodUnmarshallingException" - format: @"D-Bus message too short when unmarshalling return value for '%@'.", - name]; + format: @"D-Bus message too short when unmarshalling return value for '%@'. Expected value for argument %@ of type %c.", + name, [nextArg name], [nextArg DBusType]]; } index++; }