You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by bj...@apache.org on 2001/10/21 05:48:15 UTC

cvs commit: apr/dso/os2 dso.c

bjh         01/10/20 20:48:15

  Modified:    dso/os2  dso.c
  Log:
  OS/2: Return a proper error code from apr_dso_sym() & prevent NULL dereference
  in apr_dso_error() if called after a failure in apr_dso_sym().
  
  Revision  Changes    Path
  1.24      +11 -5     apr/dso/os2/dso.c
  
  Index: dso.c
  ===================================================================
  RCS file: /home/cvs/apr/dso/os2/dso.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- dso.c	2001/04/25 05:26:39	1.23
  +++ dso.c	2001/10/21 03:48:15	1.24
  @@ -118,8 +118,10 @@
       if (symname == NULL || ressym == NULL)
           return APR_EINIT;
   
  -    if ((rc = DosQueryProcAddr(handle->handle, 0, symname, &func)) != 0)
  -        return APR_EINIT;
  +    if ((rc = DosQueryProcAddr(handle->handle, 0, symname, &func)) != 0) {
  +        handle->load_error = APR_FROM_OS_ERROR(rc);
  +        return handle->load_error;
  +    }
   
       *ressym = func;
       return APR_SUCCESS;
  @@ -131,9 +133,13 @@
   {
       char message[200];
       apr_strerror(dso->load_error, message, sizeof(message));
  -    strcat(message, " (");
  -    strcat(message, dso->failed_module);
  -    strcat(message, ")");
  +
  +    if (dso->failed_module != NULL) {
  +        strcat(message, " (");
  +        strcat(message, dso->failed_module);
  +        strcat(message, ")");
  +    }
  +
       apr_cpystrn(buffer, message, buflen);
       return buffer;
   }