Hylafax Developers Mailing List Archives

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

[hylafax-devel] Re: **BUG** DestControls broken



Aidan Van Dyk <aidan@highrise.ca> writes:

> >> Okay, here's what happens to faxq when I try to submit a job with a DestControl active:
> 
> Yes - fxStr protects it's data, and doesn't let a [] reference get past
> the bounds (i.e. you can't get the '\0' with the [] operator).
> 
> Patch against current CVS (seems to work for me)
> 
> --- hylafax-aidan/faxd/DestControl.c++  Mon May 29 16:05:12 2000
> +++ hylafax/faxd/DestControl.c++        Mon Aug 23 07:19:32 1999
> @@ -222,20 +222,17 @@
>  crackArgv(fxStr& s)
>  {
>      int i = 0;
> -    u_int l = s.length();
> +    u_int l = s.length()+1;            // +1 for \0
>      do {
> -       while (i < l && !isspace(s[i]))
> -           i++;
> -       if (i == l)
> -           break;
> -       s[i++] = '\0';
> -       int j = i;
> -       while ( (j < l) && isspace(s[j]))
> -               j++;
> -       if (j > i) {
> +        while (s[i] && !isspace(s[i])) i++;
> +        if (s[i] == '\0') break;
> +        s[i++] = '\0';
> +        int j = i;
> +        while (isspace(s[j])) j++;
> +       if (j > i) {
>              s.remove(i, j-i);

l = s.length();

*must* be added here, because length of the string changes (which we use
later). 

>          }
> -    } while (i < l);
> +    } while (s[i] != '\0');
>      s.resize(i);
> 
> 
> 
> Also - on the topics of patches, tabs == 8 or 4?

8, although IMHO better not use them at all (only spaces).

Hope to hear from you soon,
Dmitry



____________________ HylaFAX(tm) Developers Mailing List ____________________
 To unsub: mail -s unsubscribe hylafax-devel-request@hylafax.org < /dev/null



Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services