So, how exactly do software patches work. If there is a certain bug in the source code of a program, how is this source code changed when one installs a patch? After the patch has been installed how is the program 'automatically' rebuilt?
The whole program gets updated. In essence the operation could go as follows:
Details how to manage this may vary, because for example it might not be possible to delete an executable file of a running process, so some form of a workaround is needed(run the updater as a separate program instead of the main application...). It could also be possible to simply just apply the actual changes between the old and the new file, rather than download the whole file. But again, these are just implementation details.