[PATCH] getmntent: Consolidate character decoding

Andreas Schwab schwab@linux-m68k.org
Tue Dec 15 09:27:42 GMT 2020


On Dez 15 2020, Siddhesh Poyarekar via Libc-alpha wrote:

> +	else
> +	  {
> +	    /* The kernel escapes special characters with their octal
> +	       equivalents.  */
> +	    char c = 64 * (rp[1] - '0') + 8 * (rp[2] - '0') + rp[3] - '0';
> +	    *wp++ = c;
> +	    rp += 3;

That should check that the characters are indeed digits and you are not
running past the end.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


More information about the Libc-alpha mailing list