Volumetric fire looks cuboid
You have brightness set to 1 on both of your bright contrast nodes, it should be 0 as you don't want to modify the brightness at all, increasing the brightness like this is effectively setting the background density to a value above zero, so the whole cube is being rendered.

In fact you don't even need those nodes at all

The other thing I noticed is the top attribute node should use the density attribute for the smoke, rather than the flame attribute.

In order for volumetric materials to render correctly you will also need to go to the light paths section of the render settings and set the number of volume bounces to something reasonable.