[27237] in Source-Commits
discuss commit: Fix segmentation fault on listing transactions
daemon@ATHENA.MIT.EDU (Victor Vasiliev)
Sun Aug 25 04:03:01 2013
Date: Sun, 25 Aug 2013 04:02:33 -0400
From: Victor Vasiliev <vasilvv@MIT.EDU>
Message-Id: <201308250802.r7P82XZ1011371@drugstore.mit.edu>
To: source-commits@MIT.EDU
https://github.com/mit-athena/discuss/commit/b62bbe881f0e2058f0b608a25840add2c8af71a0
commit b62bbe881f0e2058f0b608a25840add2c8af71a0
Author: Victor Vasiliev <vasilvv@mit.edu>
Date: Sun Aug 25 03:59:58 2013 -0400
Fix segmentation fault on listing transactions
Due to the fact that in readstr() the pointer to memory allocated
on stack could be replaced with a pointer to string constant, discuss(1)
failed when listing of transactions was interrupted by Ctrl+C. This
commit fixes that, probably not in the best possible way.
debian/changelog | 7 ++++++-
libds/rpcall.c | 5 ++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 2230b75..130d2b2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,14 @@
-debathena-discuss (10.0.15-0debathena3) UNRELEASED; urgency=low
+debathena-discuss (10.0.16-0debathena1) UNRELEASED; urgency=low
+ [ Jonathan Reed ]
* Switch from control.in to control (Trac: #561)
* Bump Standards-Version to 3.9.3
* Bump compat level to 7
+ [ Victor Vasiliev ]
+ * Fix segmentation fault caused by interrupting listing of the transactions
+ in the meeting.
+
-- Jonathan Reed <jdreed@mit.edu> Wed, 03 Apr 2013 13:59:39 -0400
debathena-discuss (10.0.15-0debathena2) unstable; urgency=low
diff --git a/libds/rpcall.c b/libds/rpcall.c
index d5b4a5a..1d0cae7 100644
--- a/libds/rpcall.c
+++ b/libds/rpcall.c
@@ -501,7 +501,10 @@ char *recvstr ()
if (USP_get_string(us, &str) != SUCCESS) {
rpc_err = errno;
- return("");
+ /* the invoking code will call free()
+ * on values returned from this function */
+ str = malloc(1);
+ str[0] = '\0';
}
return (str);