ArduPilot / ardupilot

ArduPlane, ArduCopter, ArduRover, ArduSub source
http://ardupilot.org/
GNU General Public License v3.0
11.02k stars 17.57k forks source link

Unintialized variable prevents MAVFTP burst read from working #18934

Closed deanharken closed 3 years ago

deanharken commented 3 years ago

Bug report

Issue details In AP_Filesystem_Param.cpp::open(), r.read_size does not get initialized. It should be initialized to 0. If read_size happens to have a non-zero value, ::read(fd, buf, count) will return EINVAL (lines 274-280).

Please describe the problem Uninitialized variable. 0 is the value it should be initialized to. It manifests itself as a failure to execute a MAVFTP burst read when requested.

Version What version was the issue encountered with 4.2.0dev

Platform [x] All [x] AntennaTracker [x] Copter [x] Plane [x] Rover [ x Submarine

Airframe type What type of airframe (flying wing, glider, hex, Y6, octa etc) N/A

Hardware type What autopilot hardware was used? (Pixhawk, Cube, Pixracer, Navio2, etc) CubeBlack and CubeOrange

Logs Please provide a link to any relevant logs that show the issue

andyp1per commented 3 years ago

Thanks for this! I tried the fix and it totally clears up ftp problems I was seeing

rmackay9 commented 3 years ago

@deanharken, nicely done!

tridge commented 3 years ago

@deanharken very nice find, thanks!