<div dir="ltr">Hello Dave,<div><br></div><div>Ping....</div><div class="gmail_extra"><br><div class="gmail_quote">2017-01-12 10:18 GMT+08:00 Li Qiang <span dir="ltr"><<a href="mailto:liq3ea@gmail.com" target="_blank">liq3ea@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello Dave,<div><br></div><div>Should I send another patch for virglrenderer?</div><div><br></div><div>Thanks.<div><div class="h5"><br><div class="gmail_extra"><br><div class="gmail_quote">2017-01-11 22:44 GMT+08:00 Marek Olšák <span dir="ltr"><<a href="mailto:maraeo@gmail.com" target="_blank">maraeo@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Pushed, thanks.<br>
<br>
Marek<br>
<div><div class="m_-2300299103632709082h5"><br>
On Tue, Jan 10, 2017 at 9:56 AM, Li Qiang <<a href="mailto:liq3ea@gmail.com" target="_blank">liq3ea@gmail.com</a>> wrote:<br>
> In parse_identifier, it doesn't stop copying '*pcur'<br>
> untill encounter the NULL. As the 'ret' has a<br>
> fixed-size buffer, if the '*pcur' has a long string,<br>
> there will be a buffer overflow. This patch avoid this.<br>
><br>
> Signed-off-by: Li Qiang <<a href="mailto:liq3ea@gmail.com" target="_blank">liq3ea@gmail.com</a>><br>
> ---<br>
> src/gallium/auxiliary/tgsi/tgs<wbr>i_text.c | 9 ++++++---<br>
> 1 file changed, 6 insertions(+), 3 deletions(-)<br>
><br>
> diff --git a/src/gallium/auxiliary/tgsi/t<wbr>gsi_text.c b/src/gallium/auxiliary/tgsi/t<wbr>gsi_text.c<br>
> index 1b4f594..308e6b5 100644<br>
> --- a/src/gallium/auxiliary/tgsi/t<wbr>gsi_text.c<br>
> +++ b/src/gallium/auxiliary/tgsi/t<wbr>gsi_text.c<br>
> @@ -208,14 +208,17 @@ static boolean parse_int( const char **pcur, int *val )<br>
> return FALSE;<br>
> }<br>
><br>
> -static boolean parse_identifier( const char **pcur, char *ret )<br>
> +static boolean parse_identifier( const char **pcur, char *ret, size_t len )<br>
> {<br>
> const char *cur = *pcur;<br>
> int i = 0;<br>
> if (is_alpha_underscore( cur )) {<br>
> ret[i++] = *cur++;<br>
> - while (is_alpha_underscore( cur ) || is_digit( cur ))<br>
> + while (is_alpha_underscore( cur ) || is_digit( cur )) {<br>
> + if (i == len - 1)<br>
> + return FALSE;<br>
> ret[i++] = *cur++;<br>
> + }<br>
> ret[i++] = '\0';<br>
> *pcur = cur;<br>
> return TRUE;<br>
> @@ -1787,7 +1790,7 @@ static boolean parse_property( struct translate_ctx *ctx )<br>
> report_error( ctx, "Syntax error" );<br>
> return FALSE;<br>
> }<br>
> - if (!parse_identifier( &ctx->cur, id )) {<br>
> + if (!parse_identifier( &ctx->cur, id, sizeof(id) )) {<br>
> report_error( ctx, "Syntax error" );<br>
> return FALSE;<br>
> }<br>
> --<br>
> 2.7.4<br>
><br>
</div></div></blockquote></div><br></div></div></div></div></div>
</blockquote></div><br></div></div>