diff options
| author | sin | 2015-03-11 09:21:00 +0000 |
|---|---|---|
| committer | sin | 2015-03-11 09:21:00 +0000 |
| commit | 499ea65dd55279319419ff288790e17de629c9a7 (patch) | |
| tree | 26a9f94f7db503f780508c0c8fe28433aa39b58f /include/string.h | |
| parent | 4b4dfea25d660a8a27e95ea531686001246b3d1e (diff) | |
Revert "Fix invalid conversion in C++ code"
This reverts commit 4b4dfea25d660a8a27e95ea531686001246b3d1e.
Diffstat (limited to 'include/string.h')
| -rw-r--r-- | include/string.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/string.h b/include/string.h index 86c258d..6771b1d 100644 --- a/include/string.h +++ b/include/string.h | |||
| @@ -10,11 +10,13 @@ void * | |||
| 10 | __fortify_memcpy(void *dest, const void *src, size_t n) | 10 | __fortify_memcpy(void *dest, const void *src, size_t n) |
| 11 | { | 11 | { |
| 12 | size_t bos = __builtin_object_size(dest, 0); | 12 | size_t bos = __builtin_object_size(dest, 0); |
| 13 | char *d = dest; | ||
| 14 | const char *s = src; | ||
| 13 | 15 | ||
| 14 | /* trap if pointers are overlapping but not if dest == src. | 16 | /* trap if pointers are overlapping but not if dest == src. |
| 15 | * gcc seems to like to generate code that relies on dest == src */ | 17 | * gcc seems to like to generate code that relies on dest == src */ |
| 16 | if ((dest < src && dest + n > src) || | 18 | if ((d < s && d + n > s) || |
| 17 | (src < dest && src + n > dest)) | 19 | (s < d && s + n > d)) |
| 18 | __builtin_trap(); | 20 | __builtin_trap(); |
| 19 | if (n > bos) | 21 | if (n > bos) |
| 20 | __builtin_trap(); | 22 | __builtin_trap(); |
