summaryrefslogtreecommitdiff
path: root/src/gnutls.h
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-04-12 22:02:54 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-04-12 22:02:54 -0700
commit273a5f82856e545365fbf9278bd739cb6c5aa35e (patch)
treebd7ce9c14b199db74fd95b29fc97bf07fd633eb9 /src/gnutls.h
parent3e047f51d5ad36df46d553d1090e28f546af9382 (diff)
downloademacs-273a5f82856e545365fbf9278bd739cb6c5aa35e.tar.gz
emacs_write: Return size_t, not ssize_t, to avoid overflow issues.
* gnutls.c, gnutls.h (emacs_gnutls_write): Return size_t, not ssize_t. * sysdep.c, lisp.h (emacs_write): Likewise. Without the above change, emacs_gnutls_write and emacs_write had undefined behavior and would typically mistakenly report an error when writing a buffer whose size exceeds SSIZE_MAX. (emacs_read, emacs_write): Remove check for negative size, as the Emacs source code has been audited now. (emacs_write): Adjust to new signature, making the code look more like that of emacs_gnutls_write. * process.c (send_process): Adjust to the new signatures of emacs_write and emacs_gnutls_write. Do not attempt to store a byte offset into an 'int'; it might overflow.
Diffstat (limited to 'src/gnutls.h')
-rw-r--r--src/gnutls.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gnutls.h b/src/gnutls.h
index b39131b6236..11f681f9c7b 100644
--- a/src/gnutls.h
+++ b/src/gnutls.h
@@ -50,7 +50,7 @@ typedef enum
#define GNUTLS_LOG2(level, max, string, extra) if (level <= max) { gnutls_log_function2 (level, "(Emacs) " string, extra); }
-ssize_t
+size_t
emacs_gnutls_write (int fildes, struct Lisp_Process *proc, const char *buf,
size_t nbyte);
ssize_t