The reaction to the cartoons that offended Muslims all over the world, was mostly violent and thus wrong.
However, what was the purpose of publishing those cartoons? Certainly not to prove that they had the "right" to publish them. This right is amply demonstrated by many magazines that thrive on publishing dirt.
Apparently three years earlier the same newspaper refused to publish some other cartoons that were offensive to Christians. Rightly so.
Freedom comes with responsibility.
As a corollary, freedom of the press must be accompanied by a responsibility not to inflame public opinion, among others, such as the responsibility to publish the truth.
Paraphrasing from a letter that has become famous in the Christian world, a Roman named Paul addressing his friends in Greece wrote: Not all that is lawful is advantageous. Not all that is lawful is constructive. No man should seek his own interest, but rather that of others. Give no offense to other people of different races or religion.
What would have been the appropriate response to the offending cartoons?
If a man is insulted, he can take legal action with the local Court. The Court will establish whether there are grounds to impose a retribution.
If the Muslims reacted intelligently, they might have spent all their energy by suing the newspaper out of existence, as an example to all that freedom implies responsibility. They might have taught a lesson to the west, using the west's own rules. They might have improved the quality of the media all over the world.
Instead, they may have wasted that chance by reacting violently.