diff options
| author | Lars Ingebrigtsen | 2019-10-20 09:40:11 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-10-20 09:40:11 +0200 |
| commit | 19f72110fc448e58dcd2d867d1db1fc547b790f2 (patch) | |
| tree | 58260ab56756161fa8a2f1dff72b16804f31e719 | |
| parent | d9a3c8974f9690e68d34a261bde58fb465750908 (diff) | |
| download | emacs-19f72110fc448e58dcd2d867d1db1fc547b790f2.tar.gz emacs-19f72110fc448e58dcd2d867d1db1fc547b790f2.zip | |
Protect against invalid punycode
* lisp/net/puny.el (puny-decode-string): Protect against invalid
punycode.
| -rw-r--r-- | lisp/net/puny.el | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lisp/net/puny.el b/lisp/net/puny.el index 23c7af80619..729076ddbd7 100644 --- a/lisp/net/puny.el +++ b/lisp/net/puny.el | |||
| @@ -63,7 +63,10 @@ For instance, \"xn--ff-2sa.org\" => \"fśf.org\"." | |||
| 63 | "Decode an IDNA/punycode-encoded string. | 63 | "Decode an IDNA/punycode-encoded string. |
| 64 | For instance \"xn--bcher-kva\" => \"bücher\"." | 64 | For instance \"xn--bcher-kva\" => \"bücher\"." |
| 65 | (if (string-match "\\`xn--" string) | 65 | (if (string-match "\\`xn--" string) |
| 66 | (puny-decode-string-internal (substring string 4)) | 66 | (condition-case nil |
| 67 | (puny-decode-string-internal (substring string 4)) | ||
| 68 | ;; If the string is invalid Punycode, just return the string. | ||
| 69 | (args-out-of-range string)) | ||
| 67 | string)) | 70 | string)) |
| 68 | 71 | ||
| 69 | (defconst puny-initial-n 128) | 72 | (defconst puny-initial-n 128) |