summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-04-20 23:21:49 +0200
committerLudovic Courtès <ludo@gnu.org>2016-04-20 23:21:49 +0200
commit85fc958d9b8b36fb4b540882dfbcec45aab9eb82 (patch)
treeea201e1ee414a0a53bdda30962501448371a4eb3
parent38f50f49f395fcda6ab3395ebaa312f8ee24d80d (diff)
downloadguix-85fc958d9b8b36fb4b540882dfbcec45aab9eb82.tar.gz
substitute: Sanitize the client-provided column number.
* guix/scripts/substitute.scm (client-terminal-columns): Sanitize the
client's column number.
-rwxr-xr-xguix/scripts/substitute.scm4
1 files changed, 3 insertions, 1 deletions
diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index fa1dd09df8..1cfab81dbd 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -981,7 +981,9 @@ found."
 default value."
   (or (and=> (or (find-daemon-option "untrusted-terminal-columns")
                  (find-daemon-option "terminal-columns"))
-             string->number)
+             (lambda (str)
+               (let ((number (string->number str)))
+                 (and number (max 20 (- number 1))))))
       80))
 
 (define (guix-substitute . args)