Nobu patched:
> --- pack.c 18 Apr 2004 23:19:45 -0000 1.69
> +++ pack.c 25 Apr 2004 06:39:33 -0000
>
> [...]
>
>     case 'Z':
>       if (len > send - s) len = send - s;
> -     {
> +     if (star) {
> +         char *t = s;
> +
> +         while (t < send && *t) t++;
> +         rb_ary_push(ary, infected_str_new(s, t - s, str));
> +         if (t < send) t++;
> +         s = t;
> +     }
> +     else {


Combining that with recognition of the length specifier:

===============================

   case 'Z':
     {
        char *t = s;

        if (len > send-s) len = send-s;
        while (t < s+len && *t) t++;
        rb_ary_push(ary, infected_str_new(s, t-s, str));
        if (t < send) t++;
        s = star ? t : s+len;
     }
     break;

===============================

s = "abc\0def\0\0jkl\0"

s.unpack('Z2Z*Z*')  #-> ["ab", "c", "def"]
s.unpack('Z6Z*Z*')  #-> ["abc", "f", ""]
s.unpack('Z7Z*Z*')  #-> ["abc", "", ""]
s.unpack('Z8Z*Z*')  #-> ["abc", "", "jkl"]
s.unpack('Z9Z*Z*')  #-> ["abc", "jkl", ""]
s.unpack('Z*Z42')   #-> ["abc", "def"]



daz