X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Futil%2Fbio.c;h=62f4904f7d19367ab973161cbbaaf6e56551f045;hb=82e765caeb53a1de54676738169dab98ca76c47e;hp=522c28cf811ed2e908daf9c916b08bf4f4045eba;hpb=bb5fe91d23b0938baa3c4f0e92a83df659df216a;p=oweals%2Fgnunet.git diff --git a/src/util/bio.c b/src/util/bio.c index 522c28cf8..62f4904f7 100644 --- a/src/util/bio.c +++ b/src/util/bio.c @@ -23,11 +23,18 @@ * @author Christian Grothoff */ #include "platform.h" -#include "gnunet_bio_lib.h" -#include "gnunet_disk_lib.h" +#include "gnunet_util_lib.h" #define LOG(kind,...) GNUNET_log_from (kind, "util",__VA_ARGS__) +#ifndef PATH_MAX +/** + * Assumed maximum path length (for source file names). + */ +#define PATH_MAX 4096 +#endif + + /** * Size for I/O buffers. */ @@ -155,7 +162,7 @@ GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, { if (min > len - pos) min = len - pos; - memcpy (&dst[pos], &h->buffer[h->pos], min); + GNUNET_memcpy (&dst[pos], &h->buffer[h->pos], min); h->pos += min; pos += min; } @@ -205,7 +212,7 @@ GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, void *result, size_t len) { - char what[1024]; + char what[PATH_MAX + 1024]; GNUNET_snprintf (what, sizeof (what), "%s:%d", file, line); return GNUNET_BIO_read (h, what, result, len); @@ -481,7 +488,7 @@ GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, const void *buffer, min = h->size - h->have; if (min > n - pos) min = n - pos; - memcpy (&h->buffer[h->have], &src[pos], min); + GNUNET_memcpy (&h->buffer[h->have], &src[pos], min); pos += min; h->have += min; if (pos == n)