Skip to content
This repository has been archived by the owner on Jun 18, 2020. It is now read-only.

Commit

Permalink
Guard against invalid utf-8 filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
lehitoskin committed May 18, 2015
1 parent 89a2e82 commit 07636f4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions callbacks.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,11 @@

; our friend wants to send us data
; needs to be in its own thread, otherwise we'll d/c(?)
; perhaps, instead of identifying file transfers by filenumber,
; they are identified by file-id
; (define fid (file-id mtox friendnumber filenumber))
(define on-file-recv-request
(λ (mtox friendnumber filenumber kind filesize filename fname-len userdata)
(λ (mtox friendnumber filenumber kind filesize filename-bytes fname-len userdata)
; guard against invalid utf-8 filenames being sent over the network
; - all invalid characters will be replaced with "_"
(define filename (bytes->string/utf-8 filename-bytes #\_))
(thread
(λ ()
(if (eq? kind 'data)
Expand Down

0 comments on commit 07636f4

Please sign in to comment.