There is a lot of good information here. Situational awareness is probably one of the most important things to keep in mind.
Be vigilant on your walk. Enjoy the time you are spending with your pet, but be aware of your surroundings and what's around you. As you are walking with your dog, always plan for the worst case scenario. What if a dog charges us from the front? The back? More than one dog? Do I have avenues of escape? Where are they? Have at the least the most rudimentary plan in your head for that 'worst case scenario'. That way, if something does happen, you have a starting point to work from.
Another thing to consider is that not all dogs behave the same. Yes, by nature dogs have certain common traits and characteristics that can be understood and exploited to your advantage. Dogs are by nature pack animals, so in certain circumstances a pack mentality can be followed and utilized to prevent an attack.
But this fails to take into account what I'll refer to as the 'human factor'. This is the part of the equation where you have to think about the human's role in the dogs development. Was/ Is this dog owned by an abusive owner who beats it constantly and starves it? Was the dog trained to fight or be a guard dog? This is, generally, the unknown. And it is this unknown that could get you into trouble.
If you posture up and present yourself in an aggressive, threatening manner towards a dog that has been trained as a guard/ attack dog or even one trained to fight other animals, that dog may see this as an indicator of you wanting to fight. In this circumstance, you may have triggered the response you were trying to avoid.
Dogs have many drives. Key amongst these for the purposes of this discussion are prey, fight, and hunt. Prey drive is the desire to bite and kill. Fight drive is the dog's desire to measure itself against and dominate another. Hunt drive is the desire to chase down it's prey.
As you can see, all three work in unison with each other. All exist in some form, along with the other drives, in all dogs. Each dog has varying levels of each drive, which help in determining it's individual disposition. All of these drives can be enhanced or diminished, but they can never be fully gotten rid of.
Sorry for drifting off onto canine psychology/ behavior 101, but I think it is important to understand the basic psychology behind why a dog acts the way he does. The more knowledge you have about your enemy, in this case the vicious dog, the better prepared you will be.
To specifically talk about your situation, who knows what set the other dog off? Maybe your dog made eye contact and was carrying himself in a dominant sort of way that the other dog took as a challenge? I'm not for a second condoning anything the other dog did or the fact that the owner needs to properly confine his animals. But, in the animal world, certain aspects of body language, eye contact, and movement could cause an attack to occur. Again, awareness and knowledge are key.
I hope some of this helps.