Ah, I'd thought this was XS...from Perl there's no good way to inspect the string buffer beyond the actual end of the perl string. But it does look like it unintentionally modifies the caller's parameter; probably not a good thing.
Is there a better way to unalias one parameter than: