]> granicus.if.org Git - curl/commit
examples/fopen: fix comparison
authorMarcel Raad <Marcel.Raad@teamviewer.com>
Sat, 25 May 2019 17:24:13 +0000 (19:24 +0200)
committerMarcel Raad <Marcel.Raad@teamviewer.com>
Wed, 5 Jun 2019 18:38:08 +0000 (20:38 +0200)
commit992083b1abe2f19947abe1d5ba01c488458f6e66
tree741ded2075c811e9353e8ce405e6a66a8ac7df97
parente23c52b3295a525fbaae9e7ed3e7061fea6dffc2
examples/fopen: fix comparison

As want is size_t, (file->buffer_pos - want) is unsigned, so checking
if it's less than zero makes no sense.
Check if file->buffer_pos is less than want instead to avoid the
unsigned integer wraparound.

Closes https://github.com/curl/curl/pull/3975
docs/examples/fopen.c