Re: [PATCH 1/1] quote: handle null and empty strings in sq_quote_buf_pretty()

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

 



"Garima Singh via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:

> +	/*
> +	 * In case of null or empty tokens, add a '' to ensure we 
> +	 * don't inadvertently drop those tokens
> +	 */

A good comment.

> +	if (!src || !*src) {

I think a caller that passes src==NULL deserves a BUG, or just a
normal segfault.  The condition here should just be "if (!*src)"
instead.

> +		strbuf_addstr(dst, "''");
> +		return;
> +	}

Otherwise, the fix itself is good.

Thanks.


>  	for (p = src; *p; p++) {
>  		if (!isalpha(*p) && !isdigit(*p) && !strchr(ok_punct, *p)) {
>  			sq_quote_buf(dst, src);



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux