<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: TurfSixNine</title>
    <description>The latest articles on DEV Community by TurfSixNine (@turfsixnine).</description>
    <link>https://dev.to/turfsixnine</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1035528%2Fa521782a-1ea1-4eed-9e04-a442758be07c.jpeg</url>
      <title>DEV Community: TurfSixNine</title>
      <link>https://dev.to/turfsixnine</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/turfsixnine"/>
    <language>en</language>
    <item>
      <title>Buffer Overflow Vulnerability C Code</title>
      <dc:creator>TurfSixNine</dc:creator>
      <pubDate>Tue, 28 Feb 2023 11:13:01 +0000</pubDate>
      <link>https://dev.to/turfsixnine/buffer-overflow-vulnerability-c-code-40ak</link>
      <guid>https://dev.to/turfsixnine/buffer-overflow-vulnerability-c-code-40ak</guid>
      <description>&lt;p&gt;Hi folks,&lt;/p&gt;

&lt;p&gt;I have this c code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdlib.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;string.h&amp;gt;

int ssp(char * str)
{
    char buffer[100];
    strcpy(buffer,str);

    return 1;
}

int main(int argc, char **argv)
{
    char str[400];
    FILE * afile;

    afile = fopen("afile", "r");
           fread(str, sizeof(char), 400, afile);
    ssp(str);

    printf("Returned Properly\n");  

    return 1;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The program provided reads the contents of a file called &lt;code&gt;"afile"&lt;/code&gt; into a character array called &lt;code&gt;str&lt;/code&gt;, which can hold up to 400 characters. It then calls the &lt;code&gt;ssp&lt;/code&gt; function and passes &lt;code&gt;str&lt;/code&gt; as an argument.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;ssp&lt;/code&gt; function copies the contents of the &lt;code&gt;str&lt;/code&gt; character array into a local character array called buffer. The &lt;code&gt;strcpy&lt;/code&gt; function used to copy the string data does not perform any bounds checking, which can lead to buffer overflow vulnerabilities if the input string is longer than the buffer size.&lt;/p&gt;

&lt;p&gt;However, the lack of bounds checking in the &lt;code&gt;strcpy&lt;/code&gt; function in the &lt;code&gt;ssp&lt;/code&gt; function can potentially lead to buffer overflow vulnerabilities if used in a larger program or in an environment with untrusted input data.&lt;/p&gt;

&lt;p&gt;Could anyone please assist with a shellcode at the end of "afile" and then store the shellcode on the stack to run? Please...&lt;/p&gt;

</description>
      <category>gaminghardware</category>
      <category>cloudgaming</category>
      <category>gamedeals</category>
      <category>gamechallenge</category>
    </item>
  </channel>
</rss>
