From 7bcfdef0b4e6d47b01b3708e2ee9f749522f74b5 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Mon, 8 Feb 2016 21:29:14 +0100 Subject: [PATCH] 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. --- src/client/networkmodel.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/client/networkmodel.cpp b/src/client/networkmodel.cpp index c85f579f..c49d1190 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; -- 2.20.1