File openssl-fips__0220_make_hmac_path_return_value_check.diff of Package compat-openssl098.703

diff -rNU 20 ../openssl-0.9.8j-o/fips/fips.c ./fips/fips.c
--- ../openssl-0.9.8j-o/fips/fips.c	2011-09-24 01:02:35.000000000 +0200
+++ ./fips/fips.c	2011-10-06 17:46:37.000000000 +0200
@@ -245,44 +245,44 @@
 	    FIPSerr(FIPS_F_FIPS_CHECK_INCORE_FINGERPRINT,FIPS_R_FINGERPRINT_DOES_NOT_MATCH_NONPIC_RELOCATED);
 	else
 	    FIPSerr(FIPS_F_FIPS_CHECK_INCORE_FINGERPRINT,FIPS_R_FINGERPRINT_DOES_NOT_MATCH);
 	return 0;
 	}
 
     return 1;
     }
 
 #else /* incore_fingerprint */
 
 /* we implement what libfipscheck does ourselves */
 
 static int
 get_library_path(const char *libname, const char *symbolname, char *path, size_t pathlen)
 {
       Dl_info info;
       void *dl, *sym;
       int rv = -1;
 
-        dl = dlopen(libname, RTLD_LAZY);
-        if (dl == NULL) {
+      dl = dlopen(libname, RTLD_LAZY);
+      if (dl == NULL) {
               return -1;
-        }       
+      }       
 
       sym = dlsym(dl, symbolname);
 
       if (sym != NULL && dladdr(sym, &info)) {
               strncpy(path, info.dli_fname, pathlen-1);
               path[pathlen-1] = '\0';
               rv = 0;
       }
 
       dlclose(dl);    
       
       return rv;
 }
 
 static const char conv[] = "0123456789abcdef";
 
 static char *
 bin2hex(void *buf, size_t len)
 {
       char *hex, *p;
@@ -390,40 +390,43 @@
       return rv;
 }
 
 static int
 FIPSCHECK_verify(const char *libname, const char *symbolname)
 {
       char path[PATH_MAX+1];
       int rv;
       FILE *hf;
       char *hmacpath, *p;
       char *hmac = NULL;
       size_t n;
       
       rv = get_library_path(libname, symbolname, path, sizeof(path));
 
       if (rv < 0)
               return 0;
 
       hmacpath = make_hmac_path(path);
 
+      if ( hmacpath == NULL )
+              return 0;
+
       hf = fopen(hmacpath, "r");
       if (hf == NULL) {
               free(hmacpath);
               return 0;
       }
 
       if (getline(&hmac, &n, hf) > 0) {
               void *buf;
               size_t hmaclen;
               char *hex;
 
               if ((p=strchr(hmac, '\n')) != NULL)
                       *p = '\0';
 
               if (compute_file_hmac(path, &buf, &hmaclen) < 0) {
                       rv = -4;
                       goto end;
               }
 
               if ((hex=bin2hex(buf, hmaclen)) == NULL) {