iagox86 / dnscat2

BSD 3-Clause "New" or "Revised" License
3.43k stars 601 forks source link

getopt_long_only() returns an int #92

Closed joncave closed 8 years ago

joncave commented 8 years ago

Fixes a bug that reveals itself on certain platforms where char is unsigned by default. When -1 is returned by getopt_long_only() it is interpreted as unsigned, i.e. 255. This leads dnscat to always complain that an unrecognised argument has been passed.

I found this whilst cross-compiling for RPi. See http://stackoverflow.com/questions/17070958/c-why-does-getopt-return-255-on-linux for similar discussion.

iagox86 commented 8 years ago

Neat, thanks! :)