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

Re: [Libguestfs] [hivex PATCH 3/5] Handle odd-length "UTF16" strings.



Richard W.M. Jones wrote:
...
> diff --git a/lib/hivex.c b/lib/hivex.c
> index b1f6ea6..71ea5c3 100644
> --- a/lib/hivex.c
> +++ b/lib/hivex.c
> @@ -1384,7 +1384,7 @@ utf16_string_len_in_bytes_max (const char *str, size_t len)
>  {
>    size_t ret = 0;
>
> -  while (len > 0 && (str[0] || str[1])) {
> +  while (len >= 2 && (str[0] || str[1])) {
>      str += 2;
>      ret += 2;
>      len -= 2;

Good one ;-)


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