[DTrace-devel] [PATCH 3/4] Perform string constant truncation without using string length prefix

Eugene Loh eugene.loh at oracle.com
Fri Jan 28 19:41:14 UTC 2022


Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
with...

On 1/26/22 11:29 AM, Kris Van Hees via DTrace-devel wrote:
> diff --git a/libdtrace/dt_bpf.c b/libdtrace/dt_bpf.c

I'm losing track, but doesn't this file need a refreshed Copyright year?

> @@ -329,14 +329,12 @@ dt_bpf_gmap_create(dtrace_hdl_t *dtp)
>   	buf = (uint8_t *)strtab;
>   	end = buf + dtp->dt_strlen;
>   	while (buf < end) {
> -		uint_t	len = (buf[0] << 8) | buf[1];
> +		uint_t	len = strlen((char *)buf + DT_STRLEN_BYTES);
>   
> -		if (len > strsize) {
> -			buf[0] = strsize >> 8;
> -			buf[1] = strsize & 0xff;

Maybe the strlen prefix "should" still be retained in this patch (and 
dumped in the next one), but... not worth worrying about this.

> -			buf[2 + strsize] = '\0';
> -		}
> -		buf += 2 + len + 1;
> +		if (len > strsize)
> +			buf[DT_STRLEN_BYTES + strsize] = '\0';
> +
> +		buf += DT_STRLEN_BYTES + len + 1;
>   	}



More information about the DTrace-devel mailing list