From 72a062d8027b730edef3c21c91e191883c7ce2bb Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 25 Feb 2014 12:35:03 -0800 Subject: [PATCH] Truncate Conduit 'clientDescription' so we don't overflow the column Summary: We store the `arc` commandline in this 255-character column, but it can be more than 255-characters long. If it's huge, truncate it. Test Plan: Executed: arc list --conduit-uri=http://local.aphront.com:8080/ --conduit-version 6.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Works fine after this patch. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D8327 --- .../conduit/method/ConduitAPI_conduit_connect_Method.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/applications/conduit/method/ConduitAPI_conduit_connect_Method.php b/src/applications/conduit/method/ConduitAPI_conduit_connect_Method.php index 0995f2748f..2e87c7cc82 100644 --- a/src/applications/conduit/method/ConduitAPI_conduit_connect_Method.php +++ b/src/applications/conduit/method/ConduitAPI_conduit_connect_Method.php @@ -61,6 +61,9 @@ final class ConduitAPI_conduit_connect_Method extends ConduitAPIMethod { $client = $request->getValue('client'); $client_version = (int)$request->getValue('clientVersion'); $client_description = (string)$request->getValue('clientDescription'); + // TODO: This should be character-oriented, not display-oriented. + // See T3307. + $client_description = phutil_utf8_shorten($client_description, 255); $username = (string)$request->getValue('user'); // Log the connection, regardless of the outcome of checks below.