From: Manuel Nickschas Date: Mon, 8 Feb 2016 20:29:14 +0000 (+0100) Subject: Don't allow newlines in buffer names X-Git-Tag: travis-deploy-test~528 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=ecf1ab29dd398f0e0beaff327443909096d24f55 Don't allow newlines in buffer names Since it is possible to enter newlines when renaming a buffer via the GUI, we need to have a sanity check that cuts off the additional lines. Fixes #1389. --- diff --git a/src/client/networkmodel.cpp b/src/client/networkmodel.cpp index 4d49efb2..ddc71dd4 100644 --- a/src/client/networkmodel.cpp +++ b/src/client/networkmodel.cpp @@ -463,6 +463,12 @@ bool QueryBufferItem::setData(int column, const QVariant &value, int role) case Qt::EditRole: { QString newName = value.toString(); + + // Sanity check - buffer names must not contain newlines! + int nlpos = newName.indexOf('\n'); + if (nlpos >= 0) + newName = newName.left(nlpos); + if (!newName.isEmpty()) { Client::renameBuffer(bufferId(), newName); return true;