Summary of the law from the ICRC text, Protection of Journalists and Media Professionals in Time of Armed Conflict (emphasis added):

Protection of journalists as civilians

Without providing a precise definition of them, humanitarian law distinguishes between two categories of journalists working in conflict zones: war correspondents accredited to the armed forces and “independent” journalists. According to the Dictionnaire de droit international public, the former category comprises all “specialized journalists who, with the authorization and under the protection of a belligerent’s armed forces, are present on the theatre of operations with a view to providing information on events related to the hostilities.” This definition reflects a practice followed during the Second World War and the Korean War, when war correspondents wore uniforms, enjoyed officers’ privileges and were placed under the authority of the head of the military unit in which they were incorporated. As for the term “journalist,” it designates, according to a 1975 draft UN convention, “…any correspondent, reporter, photographer, and their technical film, radio and television assistants who are ordinarily engaged in any of these activities as their principal occupation…”

Protection of war correspondents

War correspondents fall into the ill-defined category of “persons who accompany the armed forces without actually being members thereof.” Since they are not part of the armed forces, they enjoy civilian status and the protection derived from that status. Moreover, since they are, in a manner of speaking, associated with the war effort, they are entitled to prisoner-of-war status when they fall into the hands of the enemy, provided they have been duly authorized to accompany the armed forces. …

Protection of “embedded” journalists

Some ambiguity surrounds the status of “embedded” journalists … who accompany military troops in wartime. Embedment is not a new phenomenon; what is new is the sheer scale on which it has been practiced since the 2003 conflict in Iraq. The fact that journalists were assigned to American and British combat units and agreed to conditions of incorporation that obliged them to stick with these units, which ensured their protection, would liken them to the war correspondents mentioned in the Third Geneva Convention. And indeed, the guidelines issued by the British Ministry of Defence regarding the media grant the status of prisoners of war to embedded journalists who are taken prisoner. According to unofficial sources, however, it would seem that the French military authorities consider “embeds” as “unilaterals” who are only entitled to civilian status, as stipulated in Article 79 of Protocol I. A clarification on this point would seem essential. […]

The way in which “unilateral” journalists surround themselves with armed bodyguards can have dangerous consequences for all journalists. On 13 April 2003, the private security escort of a CNN crew on its way to Tikrit (northern Iraq) responded with an automatic weapon after the convoy came under fire at the entrance to the town. Some journalists are concerned by this new type of behaviour, which is contrary to all the rules of the profession: “Such a practice sets a dangerous precedent that could jeopardise all other journalists covering this war as well as others in the future,” said Reporters Without Borders secretary-general Robert Ménard. “There is a real risk that combatants will henceforth assume that all press vehicles are armed. Journalists can and must try to protect themselves by such methods as travelling in bulletproof vehicles and wearing bulletproof vests, but employing private security firms that do not hesitate to use their firearms just increases the confusion between reporters and combatants.”

Loss of protection

The fact that a journalist engages in propaganda cannot be considered as direct participation (see below). It is only when a journalist takes a direct part in the hostilities that he loses his immunity and becomes a legitimate target. …

Obligation to take precautionary measures when launching attacks that could affect journalists and news media

The lawfulness of an attack depends not only on the nature of the target – which must be a military objective – but also on whether the required precautions have been taken, in particular as regards respect for the principle of proportionality and the obligation to give warning. In this regard, journalists and news media do not enjoy a particular status but benefit from the general protection against the effects of hostilities that Protocol I grants to civilians and civilian objects.

The principle of proportionality: a curb on immunity for journalists and media

[…] It was only in 1977 that [the principle of proportionality] was enshrined in a convention, namely in Articles 51 (5) (b) and 57 (2) (a) (iii) of Protocol I. This principle represents an attempt to reduce as much as possible the “collateral damage” caused by military operations. It provides the criterion that makes it possible to determine to what degree such damage can be justified under international humanitarian law: there must be a reasonable correlation between legitimate destruction and undesirable collateral effects. According to the principle of proportionality as set out in the above-mentioned articles, the accidental collateral effects of the attack, that is to say the incidental harmful effects on protected persons and property, must not be excessive in relation to the anticipated military advantage. […]

Obligation to give advance warning of an attack

Although NATO contended that it had “made every possible effort to avoid civilian casualties and collateral damage” when bombing the RTS building, doubts were expressed about whether it had met its obligation to warn the civilian population in advance of the attack, as provided for under Article 57 (2) © of Protocol I (“effective advance warning shall be given of attacks which may affect the civilian population, unless circumstances do not permit”). When the United States bombed the Baghdad offices of the Al-Jazeera and Abu Dhabi television networks on 8 April 2003, killing one journalist and wounding another, it would also seem that no advance warning of the attacks had been given to the journalists. […]

Obligation to give “effective advance warning”

Protocol I requires that “effective advance warning” be given. According to Doswald-Beck, “common sense must be used in deciding whether and how to give warning, and the safety of the attacker will inevitably be taken into account.” The rule set out in Article 57 (2) © most certainly does not require that warning be given to the authorities concerned; a direct warning to the population – by means of air-dropped leaflets, radio or loudspeaker messages, etc., requesting civilians to remain at home or stay away from certain military objectives – must be considered as sufficiently effective. […]

In 1987, lieutenant colonel Burrus M. Carnaham, of the US Joint Chiefs of Staff and Michael J. Matheson, deputy legal adviser to the US Department of State, expressed the opinion that the obligation to give warning was customary in character. This opinio juris is confirmed by the practice of a considerable number of States in international and internal armed conflicts. […]

Conclusion

It follows from the above that journalists and their equipment enjoy immunity, the former as civilians, the latter as a result of the general protection that international humanitarian law grants to civilian objects. However, this immunity is not absolute. Journalists are protected only as long as they do not take a direct part in the hostilities. News media, even when used for propaganda purposes, enjoy immunity from attacks, except when they are used for military purposes or to incite war crimes, genocide or acts of violence. However, even when an attack on news media may be justified for such reasons, every feasible precaution must be taken to avoid, or at least limit, loss of human life, injury to civilians and damage to civilian objects. […]