<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 26, 2021 at 1:58 PM Harrison Edward Gerber <<a href="mailto:gerberhe11@gmail.com">gerberhe11@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">See also CID 1399721<br>
Closes #4442<br></blockquote><div><br></div><div>Blank line between these.</div><div><br></div><div>But otherwise I think this looks good.</div><div><br></div><div>Gedare... this looks like a good paper on this family of methods for</div><div>advice on safe programming:<br><br><a href="https://www.sudo.ws/todd/papers/strlcpy.html">https://www.sudo.ws/todd/papers/strlcpy.html</a><br><br></div><div>Should we put a discussion of this type of issue in the Coding Style</div><div>and reference it?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
cpukit/libpci/pci_cfg_print_code.c | 4 ++--<br>
1 file changed, 2 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/cpukit/libpci/pci_cfg_print_code.c b/cpukit/libpci/pci_cfg_print_code.c<br>
index e758fa661a..e0979db74a 100644<br>
--- a/cpukit/libpci/pci_cfg_print_code.c<br>
+++ b/cpukit/libpci/pci_cfg_print_code.c<br>
@@ -65,8 +65,8 @@ static void pci_cfg_print_device(struct pci_dev *dev, char *prefix)<br>
char name[32];<br>
char buf[8];<br>
printf("%s.resources = {\n", prefix);<br>
- strcpy(buf, prefix);<br>
- strcat(buf, "\t");<br>
+ strlcpy(buf, prefix, sizeof(buf));<br>
+ strlcat(buf, "\t", sizeof(buf));<br>
pci_cfg_print_resources(dev->resources, buf);<br>
printf("%s},\n", prefix);<br>
if (dev->next == NULL) {<br>
-- <br>
2.25.1<br>
<br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div></div>