~ubuntu-branches/ubuntu/lucid/curl/lucid-security

« back to all changes in this revision

Viewing changes to lib/easy.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2005-12-12 15:04:52 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20051212150452-2ymlra67b2p7kjyy
Tags: 7.15.1-1ubuntu1
Resynchronise with Debian to get URL parser overflow fix from 7.15.1
(CVE-2005-4077).

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
19
 * KIND, either express or implied.
20
20
 *
21
 
 * $Id: easy.c,v 1.72 2005/04/07 15:27:13 bagder Exp $
 
21
 * $Id: easy.c,v 1.73 2005/07/17 12:44:11 bagder Exp $
22
22
 ***************************************************************************/
23
23
 
24
24
#include "setup.h"
308
308
 * curl_easy_setopt() is the external interface for setting options on an
309
309
 * easy handle.
310
310
 */
311
 
typedef int (*func_T)(void);
 
311
 
312
312
CURLcode curl_easy_setopt(CURL *curl, CURLoption tag, ...)
313
313
{
314
314
  va_list arg;
315
 
  func_T param_func = (func_T)0;
316
 
  long param_long = 0;
317
 
  void *param_obj = NULL;
318
 
  curl_off_t param_offset = 0;
319
315
  struct SessionHandle *data = curl;
320
 
  CURLcode ret=CURLE_FAILED_INIT;
 
316
  CURLcode ret;
321
317
 
322
318
  if(!curl)
323
319
    return CURLE_BAD_FUNCTION_ARGUMENT;
324
320
 
325
321
  va_start(arg, tag);
326
322
 
327
 
  /* PORTING NOTE:
328
 
     Object pointers can't necessarily be casted to function pointers and
329
 
     therefore we need to know what type it is and read the correct type
330
 
     at once. This should also correct problems with different sizes of
331
 
     the types.
332
 
  */
333
 
 
334
 
  if(tag < CURLOPTTYPE_OBJECTPOINT) {
335
 
    /* This is a LONG type */
336
 
    param_long = va_arg(arg, long);
337
 
    ret = Curl_setopt(data, tag, param_long);
338
 
  }
339
 
  else if(tag < CURLOPTTYPE_FUNCTIONPOINT) {
340
 
    /* This is a object pointer type */
341
 
    param_obj = va_arg(arg, void *);
342
 
    ret = Curl_setopt(data, tag, param_obj);
343
 
  }
344
 
  else if(tag < CURLOPTTYPE_OFF_T) {
345
 
    /* This is a function pointer type */
346
 
    param_func = va_arg(arg, func_T );
347
 
    ret = Curl_setopt(data, tag, param_func);
348
 
  }
349
 
  else {
350
 
    /* This is a curl_off_t type */
351
 
    param_offset = va_arg(arg, curl_off_t);
352
 
    ret = Curl_setopt(data, tag, param_offset);
353
 
  }
 
323
  ret = Curl_setopt(data, tag, arg);
354
324
 
355
325
  va_end(arg);
356
326
  return ret;