]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
More assertion checks and malloc()->emalloc(), courtesy of Calysto
authorHarlan Stenn <stenn@ntp.org>
Thu, 28 Jun 2007 08:11:15 +0000 (04:11 -0400)
committerHarlan Stenn <stenn@ntp.org>
Thu, 28 Jun 2007 08:11:15 +0000 (04:11 -0400)
bk: 46836d23YhfwZBJjeD906OxPGCeSdg

ChangeLog
ntpd/ntp_crypto.c
ntpd/ntp_data_structures.c

index 4548fa40b99737a3d020b6b02f18bbc3d968d0a7..78fde708bd1c8a69576218b24c6281f053f043ed 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+* More assertion checks and malloc()->emalloc(), courtesy of Calysto.
 * [Bug 864] Place ntpd service in maintenance mode if using SMF on Solaris
 * [Bug 862] includefile nesting; preserve phonelist on reconfig.
 * [Bug 604] ntpd regularly dies on linux/alpha.
index 1627d65280531ee18b5433327112175a9445c960..fc17c00dc7d93fe3f81397f1521dcf67c6c1c5ce 100644 (file)
@@ -2006,10 +2006,13 @@ asn2ntp (
        char    *v;             /* pointer to ASN1_TIME string */
        struct  tm tm;          /* used to convert to NTP time */
 
+       NTP_REQUIRE(asn1time != NULL);
+       NTP_REQUIRE(asn1time->data != NULL);
+
        /*
         * Extract time string YYMMDDHHMMSSZ from ASN1 time structure.
         * Note that the YY, MM, DD fields start with one, the HH, MM,
-        * SS fiels start with zero and the Z character should be 'Z'
+        * SS fields start with zero and the Z character should be 'Z'
         * for UTC. Also note that years less than 50 map to years
         * greater than 100. Dontcha love ASN.1? Better than MIL-188.
         */
@@ -3095,6 +3098,8 @@ cert_parse(
        cnt = X509_get_ext_count(cert);
        for (i = 0; i < cnt; i++) {
                ext = X509_get_ext(cert, i);
+               NTP_INSIST(ext != NULL);
+               NTP_INSIST(ext->value != NULL);
                method = X509V3_EXT_get(ext);
                temp = OBJ_obj2nid(ext->object);
                switch (temp) {
index e1a4b7aca7fbdf4c84e9c20b0c311be65950cafa..a6539f32e6e84f539a328a25af327b89627ec5eb 100644 (file)
@@ -23,7 +23,7 @@
 
 queue *create_priority_queue(int (*get_order)(void *, void *))
 {
-    queue *my_queue = (queue *) malloc(sizeof(queue));
+    queue *my_queue = (queue *) emalloc(sizeof(queue));
     my_queue->get_order = get_order;
     my_queue->front = NULL;
     my_queue->no_of_elements = 0;
@@ -59,7 +59,7 @@ void destroy_queue(queue *my_queue)
 void *get_node(size_t size)
 {
     node *new_node;
-    new_node = (node *) malloc(sizeof(node) + size);
+    new_node = (node *) emalloc(sizeof(node) + size);
     if (new_node != NULL) {
         new_node->node_next = NULL; 
         return new_node + 1;