can: ucan: fix out of bound read in strscpy() source
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
can: ucan: fix out of bound read in strscpy() source
Commit 7fdaf8966aae ("can: ucan: use strscpy() to instead of strncpy()") unintentionally introduced a one byte out of bound read on strscpy()'s source argument (which is kind of ironic knowing that strscpy() is meant to be a more secure alternative :)).
Let's consider below buffers:
dest[len + 1]; /* will be NUL terminated */ src[len]; /* may not be NUL terminated */
When doing:
strncpy(dest, src, len); dest[len] = '\0';
strncpy() will read up to len bytes from src.
From the CVE record · Linux
The Linux kernel's CAN ucan driver can read one byte past a firmware-string buffer if the string returned by a USB control request is not NUL-terminated. The input does not establish how an attacker could trigger this or whether authentication or user interaction is required.
Engineers running Linux kernels with the CAN ucan driver should check their exposure; affected versions are not specified.