]> andersk Git - openssh.git/commitdiff
- (dtucker) [openbsd-compat/getrrsetbyname.c] Don't attempt to calloc
authordtucker <dtucker>
Mon, 19 Feb 2007 11:56:55 +0000 (11:56 +0000)
committerdtucker <dtucker>
Mon, 19 Feb 2007 11:56:55 +0000 (11:56 +0000)
   an array for signatures when there are none since "calloc(0, n) returns
   NULL on some platforms (eg Tru64), which is explicitly permitted by
   POSIX.  Diagnosis and patch by svallet genoscope.cns.fr.

ChangeLog
openbsd-compat/getrrsetbyname.c

index a8637d6100faee18778b4ffcdc87d7e4b264b4ad..3ad8c5a0c6530bc05fe061abd9961aad1765423b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
      offsite.  ok djm@, man page bits ok jmc@
  - (dtucker) [contrib/findssl.sh] Add "which" as a shell function since some
    platforms don't have it.  Patch from dleonard at vintela.com.
+ - (dtucker) [openbsd-compat/getrrsetbyname.c] Don't attempt to calloc
+   an array for signatures when there are none since "calloc(0, n) returns
+   NULL on some platforms (eg Tru64), which is explicitly permitted by
+   POSIX.  Diagnosis and patch by svallet genoscope.cns.fr.
 
 20070128
  - (djm) [channels.c serverloop.c] Fix so-called "hang on exit" (bz #52)
index 6c86e02c2ab0805dbe8c7629ba47bf3b0d9b0a96..07231d005f77394979fba9a2a44495bafc2ac76b 100644 (file)
@@ -303,10 +303,12 @@ getrrsetbyname(const char *hostname, unsigned int rdclass,
        }
 
        /* allocate memory for signatures */
-       rrset->rri_sigs = calloc(rrset->rri_nsigs, sizeof(struct rdatainfo));
-       if (rrset->rri_sigs == NULL) {
-               result = ERRSET_NOMEMORY;
-               goto fail;
+       if (rrset->rri_nsigs > 0) {
+               rrset->rri_sigs = calloc(rrset->rri_nsigs, sizeof(struct rdatainfo));
+               if (rrset->rri_sigs == NULL) {
+                       result = ERRSET_NOMEMORY;
+                       goto fail;
+               }
        }
 
        /* copy answers & signatures */
This page took 0.043146 seconds and 5 git commands to generate.