GoogleCloudPlatform / iot-device-sdk-embedded-c

Cloud IoT Device SDK for Connectivity to IoT Core.
Other
247 stars 83 forks source link

fix fopen FILE* unsigned comparison bug #100

Closed pnfisher closed 4 years ago

pnfisher commented 4 years ago

iotc_bsp_io_fs_open()

src/bsp/platform/posix/iotc_bsp_io_fs_posix.c

sets resource_handle_out to the FILE* returned by fopen() if fopen() doesn't fail. This in turn gets assigned to the resource manager's context->resource_handle. Later, iotc_resource_manager_read() in

src/libiotc/io/fs/iotc_resource_manager.c

checks to make sure context->resource_handle is not less the zero. But there's nothing about fopen() that ensures that the FILE* returned by fopen() can't be a value less than zero (when used in a signed comparison).

If iotc_resource_manager_read() is going to assume a value less than 0 indicates a BSP file io open error, then we need to replace the use of fopen() in iotc_bsp_io_fs_posix.c with open().

72

googlebot commented 4 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

pnfisher commented 4 years ago

@googlebot I signed it!

pnfisher commented 4 years ago

Point of Contact: jordanc@ecobee.com Google group: google-contributors@ecobee.com

gguuss commented 4 years ago

Code is LGTM but I'm not seeing you as having signed the CLA with the account pnfisher. Make sure you've added it here https://cla.developers.google.com with the email / username associated with your GitHub account.

pnfisher commented 4 years ago

@gguuss Sorry, but I'm supposed to be part of an employee group.

google-contributors@ecobee.com.

Am I still supposed to sign as an individual contributor even though I'm part of the above employer group? I've added my work email (philipf@ecobee.com) to my account and was told by my employer that that should be sufficient to complete the CLA signing process. If it isn't, could you let me know what step I need to take next to complete the CLA signing conundrum as an employee group member? Thanks.

gguuss commented 4 years ago

@pnfisher I just need to verify the GitHub account / email associated with the GH account has signed and then should be able to set the CLA signed bit. If you enter your GitHub/email on this page that should cover you. I checked philipf@ecobee.com and google-contributors@ecobee.com and it's not showing up.

pnfisher commented 4 years ago

@gguuss Sorry for being a bit dense. But which email should I enter on this page (https://cla.developers.google.com/clas)? My ecobee work email (philipf@ecobee.com) or my primary github email (philipnfisher@gmail.com)? And should I just enter it using the "Only Yourself" CLA link?

gguuss commented 4 years ago

Super sorry for all the friction here :(

Put in philipf@ecobee.com and your GitHub username and we should be good to go. Having only yourself should be fine.

If there's still an issue, I can reach out internally and see if I can consider you manually verified and just not showing up in our system.

pnfisher commented 4 years ago

@gguuss Okay, I've signed/entered my work email (philipf@ecobee.com) in the CLA form. (Or at least, I think I have.)

gguuss commented 4 years ago

Woohoo! It worked!

googlebot commented 4 years ago

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

ℹ️ Googlers: Go here for more info.

googlebot commented 4 years ago

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

gguuss commented 4 years ago

Merging, thanks for your contribution!