The Fourth Amendment protects you against unreasonable searches, which included your person, home or vehicle. However, you car is treated differently than your home or person, and is subject to less protection.

If you are pulled over, even if it is for something like a broken light, anything illegal in  your car that is in plain view of an officer can lead to a search of the vehicle. Plain view includes smell, so if you are pulled over and the officer smells alcohol or marijuana in your vehicle, then the officer will be able to conduct a search.

Additionally, if you give consent for an officer to search your car, it will be difficult to challenge that search in court. If an officer knows that there is no legal basis for a search, he or she may ask. If there were grounds for a search, it would happen with or without your consent.

Generally, there are three types of vehicle searches. If police have grounds to arrest the driver, they can search anything that is in the immediate vicinity of the driver. Police may also conduct an inventory search when a driver is arrested and the car is impounded. Police also may conduct probable cause searches of a vehicle if they have reason to believe that a weapon or evidence of the crime for which they stopped the driver may be found.