diff options
Diffstat (limited to 'WWW')
-rw-r--r-- | WWW/Library/Implementation/HTAnchor.c | 6 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTAtom.c | 3 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTBTree.c | 37 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTParse.c | 10 | ||||
-rw-r--r-- | WWW/Library/Implementation/SGML.c | 5 |
5 files changed, 40 insertions, 21 deletions
diff --git a/WWW/Library/Implementation/HTAnchor.c b/WWW/Library/Implementation/HTAnchor.c index 7a444400..a1602e93 100644 --- a/WWW/Library/Implementation/HTAnchor.c +++ b/WWW/Library/Implementation/HTAnchor.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTAnchor.c,v 1.66 2010/06/17 00:17:34 tom Exp $ + * $LynxId: HTAnchor.c,v 1.67 2010/06/18 09:39:24 tom Exp $ * * Hypertext "Anchor" Object HTAnchor.c * ========================== @@ -585,7 +585,9 @@ static void deleteLinks(HTChildAnchor *me) * Recursive call. Test here to avoid calling overhead. Don't delete * if document is loaded or being loaded. */ - if ((me->parent != parent) && !parent->underway && + if ((me->parent != parent) && + parent != NULL && + !parent->underway && (!parent->info || !parent->info->document)) { HTAnchor_delete(parent); } diff --git a/WWW/Library/Implementation/HTAtom.c b/WWW/Library/Implementation/HTAtom.c index 1b5bf4cb..0d07308c 100644 --- a/WWW/Library/Implementation/HTAtom.c +++ b/WWW/Library/Implementation/HTAtom.c @@ -85,7 +85,8 @@ HTAtom *HTAtom_for(const char *string) if (a->name == NULL) outofmem(__FILE__, "HTAtom_for"); - assert(a != NULL); + assert(a->name != NULL); + strcpy(a->name, string); a->next = hash_table[hash]; /* Put onto the head of list */ hash_table[hash] = a; diff --git a/WWW/Library/Implementation/HTBTree.c b/WWW/Library/Implementation/HTBTree.c index 0c172ac4..3a76550e 100644 --- a/WWW/Library/Implementation/HTBTree.c +++ b/WWW/Library/Implementation/HTBTree.c @@ -145,6 +145,9 @@ void HTBTree_add(HTBTree *tree, if (tree->top == NULL) outofmem(__FILE__, "HTBTree_add"); + + assert(tree->top != NULL); + tree->top->up = NULL; tree->top->object = object; tree->top->left = NULL; @@ -169,6 +172,9 @@ void HTBTree_add(HTBTree *tree, if (father_of_element->left == NULL) outofmem(__FILE__, "HTBTree_add"); + + assert(father_of_element->left != NULL); + added_element = father_of_element->left; added_element->up = father_of_element; added_element->object = object; @@ -250,18 +256,23 @@ void HTBTree_add(HTBTree *tree, * with the two following conditions (4 March 94 - AS) */ - if ((father_of_element->left == NULL) - && (father_of_element->right->right == NULL) - && (father_of_element->right->left->left == NULL) - && (father_of_element->right->left->right == NULL)) - corrections = 7; - - if ((father_of_element->left != NULL) - && (father_of_element->right == NULL) - && (father_of_element->left->left == NULL) - && (father_of_element->left->right->right == NULL) - && (father_of_element->left->right->left == NULL)) - corrections = 7; + if (father_of_element->left == NULL) { + if ((father_of_element->right != NULL) + && (father_of_element->right->right == NULL) + && (father_of_element->right->left != NULL) + && (father_of_element->right->left->left == NULL) + && (father_of_element->right->left->right == NULL)) { + corrections = 7; + } + } else { + if ((father_of_element->right == NULL) + && (father_of_element->left->left == NULL) + && (father_of_element->left->right != NULL) + && (father_of_element->left->right->right == NULL) + && (father_of_element->left->right->left == NULL)) { + corrections = 7; + } + } if ((father_of_element->left != NULL) && (father_of_element->left_depth > father_of_element->right_depth)) { @@ -355,7 +366,7 @@ void HTBTree_add(HTBTree *tree, father_of_element->up = added_element; if (father_of_element->left != NULL) father_of_element->left->up = father_of_element; - } else { + } else if (father_of_element->right != NULL) { added_element = father_of_element->right; father_of_element->right_depth = added_element->left_depth; added_element->left_depth = 1 + diff --git a/WWW/Library/Implementation/HTParse.c b/WWW/Library/Implementation/HTParse.c index ec6d2193..05f5d23f 100644 --- a/WWW/Library/Implementation/HTParse.c +++ b/WWW/Library/Implementation/HTParse.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTParse.c,v 1.57 2010/06/18 00:15:07 tom Exp $ + * $LynxId: HTParse.c,v 1.58 2010/06/18 09:09:22 tom Exp $ * * Parse HyperText Document Address HTParse.c * ================================ @@ -351,7 +351,9 @@ char *HTParse(const char *aName, len = len1 + len2 + MIN_PARSE; /* Lots of space: more than enough */ need = (len * 2 + len1 + len2); - if (need > (size_t) max_uri_size) + if (need > (size_t) max_uri_size || + (int) need < (int) len1 || + (int) need < (int) len2) return StrAllocCopy(return_value, ""); result = tail = (char *) LYalloca(need); @@ -751,7 +753,9 @@ const char *HTParseAnchor(const char *aName) size_t need = ((unsigned) ((p - aName) + (int) strlen(p) + 1)); char *name; - if (need > (size_t) max_uri_size) { + if (need > (size_t) max_uri_size || + (int) need < (int) (p - aName) || + (int) need < (int) strlen(p)) { p += strlen(p); } else { name = (char *) LYalloca(need); diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c index d55bf452..0bd56de8 100644 --- a/WWW/Library/Implementation/SGML.c +++ b/WWW/Library/Implementation/SGML.c @@ -1,5 +1,5 @@ /* - * $LynxId: SGML.c,v 1.134 2010/06/16 23:27:40 tom Exp $ + * $LynxId: SGML.c,v 1.135 2010/06/18 09:59:35 tom Exp $ * * General SGML Parser code SGML.c * ======================== @@ -1099,7 +1099,8 @@ static void end_element(HTStream *context, HTTag * old_tag) CTRACE((tfp, "SGML: Nesting <%s>...<%s> \t<- ***invalid end </%s>\n", old_tag->name, - context->element_stack->tag->name, + context->element_stack ? + context->element_stack->tag->name : "none", old_tag->name)); return; } |