<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Anfänger Problem]]></title><description><![CDATA[<p>Hallo, ich hab noch wenige C++ Kenntnisse. Allerdings hab ich eine simple Aufgabe an der Uni bekommen, wo ich diese benötige. Wäre nett wenn mir hier jemand helfen könnte.</p>
<p>folgernder Code Schnipsel:</p>
<p>void read() {<br />
char read_buf[100];<br />
gets(read_buf);<br />
}</p>
<p>Das Code Stück soll auf die Anfälligkeit eines Buffer Overflows untersucht werden und ggf. eine Möglichkeit den zu verhindern.</p>
<p>Danke im voraus!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/126257/anfänger-problem</link><generator>RSS for Node</generator><lastBuildDate>Mon, 24 Aug 2026 14:52:39 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/126257.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 13 Nov 2005 13:38:16 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Anfänger Problem on Sun, 13 Nov 2005 13:38:16 GMT]]></title><description><![CDATA[<p>Hallo, ich hab noch wenige C++ Kenntnisse. Allerdings hab ich eine simple Aufgabe an der Uni bekommen, wo ich diese benötige. Wäre nett wenn mir hier jemand helfen könnte.</p>
<p>folgernder Code Schnipsel:</p>
<p>void read() {<br />
char read_buf[100];<br />
gets(read_buf);<br />
}</p>
<p>Das Code Stück soll auf die Anfälligkeit eines Buffer Overflows untersucht werden und ggf. eine Möglichkeit den zu verhindern.</p>
<p>Danke im voraus!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/916729</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/916729</guid><dc:creator><![CDATA[Snarch]]></dc:creator><pubDate>Sun, 13 Nov 2005 13:38:16 GMT</pubDate></item><item><title><![CDATA[Reply to Anfänger Problem on Sun, 13 Nov 2005 13:45:22 GMT]]></title><description><![CDATA[<p>scanf(&quot;%99s&quot;,buf);</p>
]]></description><link>https://www.c-plusplus.net/forum/post/916739</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/916739</guid><dc:creator><![CDATA[Cpt. Tanga]]></dc:creator><pubDate>Sun, 13 Nov 2005 13:45:22 GMT</pubDate></item><item><title><![CDATA[Reply to Anfänger Problem on Sun, 13 Nov 2005 13:54:20 GMT]]></title><description><![CDATA[<blockquote>
<p>Das Code Stück soll auf die Anfälligkeit eines Buffer Overflows untersucht werden</p>
</blockquote>
<p>Dazu solltest du zwei Dinge berücksichtigen:</p>
<blockquote>
<p>char read_buf[100];</p>
</blockquote>
<p>Das ist ein Array der festen Größe 100. Du hast also Platz für ganz genau 100 chars.</p>
<blockquote>
<p>gets(read_buf);</p>
</blockquote>
<p>Du liest mittels der Eingabefunktion gets. Also brauchst du deren Beschreibung:<br />
<a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?gets+3" rel="nofollow">http://unixhelp.ed.ac.uk/CGI/man-cgi?gets+3</a></p>
<blockquote>
<p>gets() reads a line from stdin into the buffer pointed to by s until<br />
either a terminating newline or EOF, which it replaces with '\0'.</p>
</blockquote>
<p>Jetzt sollte das Problem bereits klar sein - achte auf die &quot;until&quot;-Bedingung.<br />
Ansonsten musst du noch etwas weiterlesen:</p>
<blockquote>
<p>No check for buffer overrun is performed (see BUGS below) [...]<br />
Never use gets(). Because it is impossible to tell without knowing the data in advance how many characters gets() will read, and because<br />
gets() will continue to store characters past the end of the buffer, it<br />
is extremely dangerous to use. It has been used to break computer<br />
security. Use fgets() instead.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/916754</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/916754</guid><dc:creator><![CDATA[HumeSikkins]]></dc:creator><pubDate>Sun, 13 Nov 2005 13:54:20 GMT</pubDate></item></channel></rss>