Try to send bug reports and look at how they fix it. Sometimes it is even difficult to find the file that must be fixed. Perhaps next time you spot a bug, it is in the same file and you can fix it.
Start with small changes, I recommend not investing more than one of two afternoons because the maintainer may not merge it. Perhaps because the code is bad, perhaps because it doesn't follow the (implicit hidden) spirit of the project, perhaps because the maintainer is a moron.
Try to follow the nearby code style. Each project/maintainer has preferences. If you break them, the maintainer may ask nicely to fix them before merging.
(If they are not nice, just forget about the project. You have lost only two afternoons.)
(Whitespace changes is a hot topic, try to avoid whitespace changes unless you know the local policy.)
That's why there are maintainers who will tell you what you should change in order for your patch to be accepted upstream. This happens all the time, just go and read the mailing list or active Pull Requests of the project. (This is a good idea anyway, as reading through pull requests and comments will give you a good idea how 'things are done' in that project)
And don't worry, most maintainers are usually very friendly to newcomers. :)
If you contribute something to the Open Source community that works and is useful, then you might find some people who really appreciate the effort you went to.
...regardless of code quality...