TOSMBClient icon indicating copy to clipboard operation
TOSMBClient copied to clipboard

Connection error not handled correctly in requestContentsOfDirectoryAtFilePath

Open jimkeir opened this issue 7 years ago • 1 comments

Hardware / Software

Which version of the library were you using? 1.0.8, from pod

Which version of iOS are you running? 11

What model of iOS device were you testing on? iPad Air 2

If using CocoaPods, which version of CocoaPods are you on? 1.3.1

In TOSMBSession.m, lines 291-3 are: smb_tid shareID = -1; smb_tree_connect(self.session, cStringName, &shareID); if (shareID < 0) {

The bundled version of smb_share.h declares shareID as smb_tid, and smb_types.h declares this as uint16_t . The comparison "shareID < 0" is never true, because the range of values of uint16_t is 0 -> 65535 . Use the return code of smb_tree_connect, which is signed int, instead of the smb_tid.

jimkeir avatar Nov 21 '17 14:11 jimkeir

Oh! Nicely spotted! Thanks! I'll need to fix that when I get the chance.

TimOliver avatar Nov 27 '17 17:11 TimOliver