In that case, this should work (haven't tried compiling yet though!):
char nullChar = '\0';
NSMutableData *pwdData = [NSMutableData dataWithData:[password dataUsingEncoding:encoding]];
[pwdData appendBytes:&nullChar length:sizeof(char)];
return [pwdData bytes];
There will still be problems if the password string's encoding contains any nulls (like Unicode), but I don't think that's going to be a common case, and xadFileUnArc can't handle such encodings anyway.