Commit 50806f8b authored by Gregor Michalicek's avatar Gregor Michalicek
Browse files

Corrected theoretically possible segmentation fault in io/xmlIntWrapFort.f90

The issue was due to the reading of a c string into a fortran character array.
Up to now all 255 elements were read into the array and later the output
was reduced to the part in front of the c string termination null character.

Of course, this is wrong and valgrind complained. Everything after the string
termination character might not belong to the program. Therefore I fixed this.
But to my knowledge this issue never produced a problem.
parent 19f06f38
......@@ -196,12 +196,16 @@ FUNCTION xmlGetAttributeValue(xPath)
CALL juDFT_error("Attribute value could not be obtained.",calledby="xmlGetAttributeValue")
DO i=1, 255
value = ''
i = 1
DO WHILE ((valueFromC(i).NE.C_NULL_CHAR).AND.(i.LE.255))
value(i:i) = valueFromC(i)
i = i + 1
length = LEN_TRIM(value(1:INDEX(value, CHAR(0))))
length = i-1
xmlGetAttributeValue = value(1:length-1)
xmlGetAttributeValue = value(1:length)
END FUNCTION xmlGetAttributeValue
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment