cURL / Mailing Lists / curl-library / Single Mail


Potential integer overflow with write callback

From: <>
Date: Sat, 26 Mar 2011 21:37:26 -0400

Hi everyone,

My write callback function looks like this:

size_t writehttpcallback ( void *ptr, size_t size, size_t nmemb, void
  size_t realsize = size*nmemb;
  return realsize;

Now, size_t is guaranteed only to be at least 16 bits according to the
standard, which means that if realsize turns out to be more than 64
kilobytes, it might overflow. I'm assuming that it's not unheard of to
get 64 kilobytes in an HTTP transaction.

Does the library account for possible overflows? Or do I have to
detect them myself?


List admin:
Received on 2011-03-27