diff options
author | Richard Hughes <richard@hughsie.com> | 2016-10-19 20:34:40 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2016-10-19 20:34:42 +0100 |
commit | 27b927c0a7aa12a9ca3ada5dfa7a6f2b6b4deb9e (patch) | |
tree | 64fa328bc5775e07528cf0fa8aedf2e9ef37d9a0 /src | |
parent | ef4b3eb3f70a9e3cda85548a188397f9ce4ad1bb (diff) |
Check for a zero-length search string before passing to backends
Some backends can't cope with this (cough, aptcc, cough) and explode.
This is probably not what the user wants, so return an error to the client if
this is attempted.
Diffstat (limited to 'src')
-rw-r--r-- | src/pk-transaction.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/pk-transaction.c b/src/pk-transaction.c index fe6ec9f98..4f0cc2b4f 100644 --- a/src/pk-transaction.c +++ b/src/pk-transaction.c @@ -2195,6 +2195,13 @@ pk_transaction_strvalidate (const gchar *text, GError **error) /* maximum size is 1024 */ length = pk_strlen (text, 1024); + if (length == 0) { + g_set_error_literal (error, + PK_TRANSACTION_ERROR, + PK_TRANSACTION_ERROR_INPUT_INVALID, + "Invalid input passed to daemon: zero length string"); + return FALSE; + } if (length > 1024) { g_set_error (error, PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_INPUT_INVALID, "Invalid input passed to daemon: input too long: %u", length); |