[haiku-commits] Re: r41085 - haiku/trunk/src/kits/tracker

  • From: Jérôme Duval <korli@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 23 Mar 2011 00:20:43 +0100

2011/3/22  <jonas@xxxxxxxxxxx>:
> -       // check if there is a shortcut
> +       // check if there is a shortcut in the model name
>        uint32 length = strlen(result);
> -       shortcut = '\0';
> -       if (result[length - 2] == '-') {
> +       if (result[length - 2] == '-' && length > 2) {
>                shortcut = result[length - 1];
>                result[length - 2] = '\0';
> +               return;
>        }

You should check the length before accessing the array (2 times in this commit).

Bye,
Jérôme

Other related posts: