Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the potential error reported by Prefast code analysis #788

Merged
merged 1 commit into from
Jun 5, 2018
Merged

Fixed the potential error reported by Prefast code analysis #788

merged 1 commit into from
Jun 5, 2018

Conversation

yitam
Copy link
Contributor

@yitam yitam commented Jun 5, 2018

To fix this warning from Prefast:
pdo_sqlsrv\pdo_dbh.cpp(1303) : warning C6385: Reading invalid data from 'last_insert_id_query': the readable size is '184' bytes, but '2147483647' bytes may be read.


This change is Reviewable

@codecov-io
Copy link

codecov-io commented Jun 5, 2018

Codecov Report

Merging #788 into dev will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##              dev     #788   +/-   ##
=======================================
  Coverage   80.06%   80.06%           
=======================================
  Files          25       25           
  Lines        7323     7323           
=======================================
  Hits         5863     5863           
  Misses       1460     1460

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4509756...10ff344. Read the comment docs.

@yitam yitam requested a review from david-puglielli June 5, 2018 20:44
@david-puglielli
Copy link
Contributor

Isn't it possible that any call to strlen_s would produce this error, since we don't specify the length argument?

@yitam
Copy link
Contributor Author

yitam commented Jun 5, 2018

@david-puglielli -- in this particular case strnlen_s() was called to determine how many characters are in the input string to be converted. Yet, it should never reach INT_MAX (2147483647), the limit that we use for strnlen_s() , because last_insert_id_query is either LAST_INSERT_ID_QUERY or SEQUENCE_CURRENT_VALUE_QUERY with the sequence name. However, the code change in this PR is required to get rid of this warning.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.003%) to 74.7% when pulling 10ff344 on yitam:fillLastID into 4509756 on Microsoft:dev.

@yitam yitam merged commit 3585bf5 into microsoft:dev Jun 5, 2018
@yitam yitam deleted the fillLastID branch June 5, 2018 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants