removed fuck from code
parent
5b4e49242d
commit
8bde12a2bb
20
fillin.c
20
fillin.c
|
@ -6,12 +6,15 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
// prefix for debug prints
|
||||||
|
#define SSS "-fillin-\t"
|
||||||
|
|
||||||
// https://refspecs.linuxbase.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/libc---strcpy-chk-1.html
|
// https://refspecs.linuxbase.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/libc---strcpy-chk-1.html
|
||||||
// TODO: actually check for overflows
|
// TODO: actually check for overflows
|
||||||
char * __strcpy_chk(char * dest, const char * src, size_t destlen) {
|
char * __strcpy_chk(char * dest, const char * src, size_t destlen) {
|
||||||
char *d = dest;
|
char *d = dest;
|
||||||
|
|
||||||
//printf("FUCK STRCPY %s :::: %s\n", src, dest);
|
//printf(SSS "STRCPY %s :::: %s\n", src, dest);
|
||||||
|
|
||||||
while (*src != '\0') {
|
while (*src != '\0') {
|
||||||
*d++ = *src++;
|
*d++ = *src++;
|
||||||
|
@ -25,7 +28,7 @@ char * __strcpy_chk(char * dest, const char * src, size_t destlen) {
|
||||||
// https://refspecs.linuxbase.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/libc---stpcpy-chk-1.html
|
// https://refspecs.linuxbase.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/libc---stpcpy-chk-1.html
|
||||||
char * __stpcpy_chk(char * dest, const char * src, size_t destlen) {
|
char * __stpcpy_chk(char * dest, const char * src, size_t destlen) {
|
||||||
|
|
||||||
printf("FUCK STPCPY %s :::: %s\n", src, dest);
|
printf(SSS "STPCPY %s :::: %s\n", src, dest);
|
||||||
|
|
||||||
return stpcpy(dest, src);
|
return stpcpy(dest, src);
|
||||||
}
|
}
|
||||||
|
@ -33,7 +36,7 @@ char * __stpcpy_chk(char * dest, const char * src, size_t destlen) {
|
||||||
// https://refspecs.linuxbase.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/libc---strncpy-chk-1.html
|
// https://refspecs.linuxbase.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/libc---strncpy-chk-1.html
|
||||||
char * __strncpy_chk(char * dest, const char * src, size_t n, size_t dest_1len) {
|
char * __strncpy_chk(char * dest, const char * src, size_t n, size_t dest_1len) {
|
||||||
|
|
||||||
printf("FUCK STRNCPY %s :::: %s\n", src, dest);
|
printf(SSS "STRNCPY %s :::: %s\n", src, dest);
|
||||||
|
|
||||||
return strncpy(dest, src, n);
|
return strncpy(dest, src, n);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +44,7 @@ char * __strncpy_chk(char * dest, const char * src, size_t n, size_t dest_1len)
|
||||||
// https://refspecs.linuxbase.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/libc---strcat-chk-1.html
|
// https://refspecs.linuxbase.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/libc---strcat-chk-1.html
|
||||||
// TODO: There's some good info being dumped here
|
// TODO: There's some good info being dumped here
|
||||||
char * __strcat_chk(char * dest, const char * src, size_t destlen) {
|
char * __strcat_chk(char * dest, const char * src, size_t destlen) {
|
||||||
//printf("!!! strcat %s :::: %s\n", src, dest);
|
printf("!!! strcat %s :::: %s\n", src, dest);
|
||||||
|
|
||||||
char *res = strncat(dest, src, destlen);
|
char *res = strncat(dest, src, destlen);
|
||||||
|
|
||||||
|
@ -51,7 +54,7 @@ char * __strcat_chk(char * dest, const char * src, size_t destlen) {
|
||||||
// https://refspecs.linuxbase.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/libc---memcpy-chk-1.html
|
// https://refspecs.linuxbase.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/libc---memcpy-chk-1.html
|
||||||
void * __memcpy_chk(void * dest, const void * src, size_t len, size_t destlen) {
|
void * __memcpy_chk(void * dest, const void * src, size_t len, size_t destlen) {
|
||||||
|
|
||||||
//puts("FUCK MEMCPY \n");
|
//puts(SSS "MEMCPY \n");
|
||||||
|
|
||||||
return memcpy(dest, src, len);
|
return memcpy(dest, src, len);
|
||||||
}
|
}
|
||||||
|
@ -59,7 +62,7 @@ void * __memcpy_chk(void * dest, const void * src, size_t len, size_t destlen) {
|
||||||
// https://refspecs.linuxbase.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/libc---memset-chk-1.html
|
// https://refspecs.linuxbase.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/libc---memset-chk-1.html
|
||||||
void * __memset_chk(void * dest, int c, size_t len, size_t destlen) {
|
void * __memset_chk(void * dest, int c, size_t len, size_t destlen) {
|
||||||
|
|
||||||
puts("FUCK MEMSET\n");
|
puts(SSS "MEMSET\n");
|
||||||
|
|
||||||
return memset(dest, c, len);
|
return memset(dest, c, len);
|
||||||
}
|
}
|
||||||
|
@ -110,14 +113,15 @@ int __sprintf_chk(char * str, int flag, size_t strlen, const char * format, ...)
|
||||||
}
|
}
|
||||||
|
|
||||||
void __longjmp_chk () {
|
void __longjmp_chk () {
|
||||||
// puts("FUCK LONG JMP\n");
|
// puts(SSS "LONG JMP\n");
|
||||||
asm("pop %rbp");
|
asm("pop %rbp");
|
||||||
|
// I think this is a GNU extention, but it's an easy way to do it
|
||||||
goto *(&longjmp);
|
goto *(&longjmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __fread_chk () {
|
void __fread_chk () {
|
||||||
// asm ("pop %rbp");
|
// asm ("pop %rbp");
|
||||||
puts("FUCK FREAD\n");
|
puts(SSS "FREAD\n");
|
||||||
// stub
|
// stub
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue