File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ export class AFCClient extends ServiceClient<AFCProtocolClient> {
5252 async openFile ( path : string ) : Promise < Buffer > {
5353 debug ( `openFile: ${ path } ` ) ;
5454 // mode + path + null terminator
55- const data = Buffer . alloc ( 8 + path . length + 1 ) ;
55+ const data = Buffer . alloc ( 8 + Buffer . byteLength ( path ) + 1 ) ;
5656 // write mode
5757 data . writeUInt32LE ( AFC_FILE_OPEN_FLAGS . WRONLY , 0 ) ;
5858 // then path to file
@@ -176,7 +176,7 @@ export class AFCClient extends ServiceClient<AFCProtocolClient> {
176176}
177177
178178function toCString ( s : string ) {
179- const buf = Buffer . alloc ( s . length + 1 ) ;
179+ const buf = Buffer . alloc ( Buffer . byteLength ( s ) + 1 ) ;
180180 const len = buf . write ( s ) ;
181181 buf . writeUInt8 ( 0 , len ) ;
182182 return buf ;
You can’t perform that action at this time.
0 commit comments