Skip to content

Instantly share code, notes, and snippets.

@namore
Created October 19, 2015 11:58
Show Gist options
  • Save namore/677bc0fdda306cc1897d to your computer and use it in GitHub Desktop.
Save namore/677bc0fdda306cc1897d to your computer and use it in GitHub Desktop.
ns3/dce patch
diff -r 9e75ce0b8d7c example/dce-httpd.cc
--- a/example/dce-httpd.cc Thu Sep 03 17:08:26 2015 +0900
+++ b/example/dce-httpd.cc Fri Oct 09 11:16:03 2015 +0200
@@ -39,6 +39,7 @@
fprintf (fp, "%d\n", i);
}
fclose (fp);
+ chmod ("files-0/index.html", 0744);
}
int
main (int argc, char *argv[])
diff -r 9e75ce0b8d7c model/dce-string.cc
--- a/model/dce-string.cc Thu Sep 03 17:08:26 2015 +0900
+++ b/model/dce-string.cc Fri Oct 09 11:16:03 2015 +0200
@@ -27,6 +27,12 @@
strcpy (__dest, __src);
}
+void * dce___memcpy_chk(void * __dest, const void * __src, size_t __len, size_t __destlen)
+{
+ /// \todo Do actual checking
+ memcpy (__dest, __src, __len);
+}
+
char * dce_strpbrk (const char *s, const char *a)
{
return (char*) strpbrk (s, a);
@@ -36,3 +42,4 @@
{
return (char*)strstr (u, d);
}
+
diff -r 9e75ce0b8d7c model/dce-string.h
--- a/model/dce-string.h Thu Sep 03 17:08:26 2015 +0900
+++ b/model/dce-string.h Fri Oct 09 11:16:03 2015 +0200
@@ -12,6 +12,7 @@
char * dce___strcpy_chk (char *__restrict __dest,
const char *__restrict __src,
size_t __destlen);
+void * dce___memcpy_chk(void * __dest, const void * __src, size_t __len, size_t __destlen);
char * dce_strpbrk (const char *s, const char *accept);
char * dce_strstr (const char *h, const char *n);
diff -r 9e75ce0b8d7c model/libc-dce.cc
--- a/model/libc-dce.cc Thu Sep 03 17:08:26 2015 +0900
+++ b/model/libc-dce.cc Fri Oct 09 11:16:03 2015 +0200
@@ -100,6 +100,7 @@
#include <math.h>
#include <assert.h>
#include <dlfcn.h>
+#include <sys/mman.h>
extern void __cxa_finalize (void *d);
extern int __cxa_atexit (void (*func)(void *), void *arg, void *d);
@@ -118,6 +119,8 @@
extern char * __strcpy_chk (char *__restrict __dest,
const char *__restrict __src,
size_t __destlen);
+extern void * __memcpy_chk(void *, const void *, size_t, size_t);
+
// from glibc's stdio.h
extern int __sprintf_chk (char *, int, size_t, const char *, ...) __THROW;
extern int __snprintf_chk (char *, size_t, int, size_t, const char *, ...)
diff -r 9e75ce0b8d7c model/libc-ns3.h
--- a/model/libc-ns3.h Thu Sep 03 17:08:26 2015 +0900
+++ b/model/libc-ns3.h Fri Oct 09 11:16:03 2015 +0200
@@ -111,6 +111,9 @@
DCE (tmpfile)
DCE (rename)
+// SYS/MMAN.h
+NATIVE (madvise)
+
// STRING.H
NATIVE (bzero)
NATIVE (strerror)
@@ -118,6 +121,7 @@
NATIVE (strcoll)
NATIVE (memset)
NATIVE (memcpy)
+DCE (__memcpy_chk)
NATIVE (bcopy)
NATIVE (memcmp)
NATIVE (memmove)
@@ -581,6 +585,7 @@
NATIVE (__ctype_b_loc)
NATIVE_WITH_ALIAS (wctype_l)
NATIVE (__ctype_tolower_loc)
+NATIVE (__ctype_toupper_loc)
// stdlib.h
NATIVE (__ctype_get_mb_cur_max)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment