  Two-dimensional second-order topological insulators are characterized by the
presence of topologically protected zero-energy bound states localized at the
corners of a flake. In this paper we theoretically study the occurrence and
features of such corner states inside flakes in the shape of a convex polygon.
We consider two different models, both in Cartan class IIIA, the first obeying
inversion symmetry and the other obeying a combined $\pi/4$ rotation symmetry
and time-reversal symmetry ($\hat{C}_4^z\hat{T}$). By using an analytical
effective model of an edge corresponding to a massive Dirac fermion, we
determine the presence of a corner state between two given edges by studying
the sign of their induced masses and derive general rules for flakes in the
shape of a convex polygon. In particular, we find that the number of corner
states in a flake is always two in the first model, while in the second model
there are either 0, 2 or 4. To corroborate our findings, we focus on flakes of
specific shapes (a triangle and a square) and use a numerical finite-difference
approach to determine the features of the corner states in terms of their
probability density. In the case of a triangular flake, we can change the
position of corner states by rotating the flake in the first model, while in
the second model we can also change their number. Remarkably, when the induced
mass of an edge is zero the corresponding corner state becomes delocalized
along the edge. In the case of a square flake and the model with
$\hat{C}_4^z\hat{T}$ symmetry, there is an orientation of the flake with
respect to the crystal axes, for which the corner states extend along the whole
perimeter of the square.
