celix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [celix] ycaibb opened a new issue #289: Possible NULL pointer dereference in the method manifestParser_parseExportHeader??
Date Thu, 29 Oct 2020 11:50:22 GMT

ycaibb opened a new issue #289:
URL: https://github.com/apache/celix/issues/289


   
   
   
   
   Dear developers:
          Our static tool reports a null pointer dereference on this [method.](https://github.com/apache/celix/blob/master/libs/framework/src/manifest_parser.c#L407)
The reason is `clauses`can be null at [here](https://github.com/apache/celix/blob/master/libs/framework/src/manifest_parser.c#L414).
Can linked_list_pt manifestParser_parseStandardHeader return NULL?  Thank you for your confirmation.
   
   
   ```
   static linked_list_pt manifestParser_parseStandardHeader(const char * header) {
   	linked_list_pt clauseStrings = NULL;
   	linked_list_pt completeList = NULL;
   
   	if(header != NULL && strlen(header)==0){
   		return NULL;
   	}
   
   	if (linkedList_create(&completeList) == CELIX_SUCCESS) {
   		if(header!=NULL){
   			char *hdr = strdup(header);
   			clauseStrings = manifestParser_parseDelimitedString(hdr, ",");
   			free(hdr);
   			if (clauseStrings != NULL) {
   				int i;
   				for (i = 0; i < linkedList_size(clauseStrings); i++) {
   					char *clauseString = (char *) linkedList_get(clauseStrings, i);
   					linkedList_addElement(completeList, manifestParser_parseStandardHeaderClause(clauseString));
   					free(clauseString);
   				}
   				linkedList_destroy(clauseStrings);
   			}
   		}
   
   	}
   
   	return completeList;
   }
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message