??? 03/01/08 15:22 Read: times |
#151735 - Yes. Check your input! Responding to: ???'s previous message |
Peter said:
I'm wondering : I'm writing PC software which has the possiblity to read and write config files to and from harddisk. Is it common practice to check the content of the config file when reading it back into the application?
There is a (unwanted!!) possiblity that the user changes the file which can cause weird things in the application. I think you have answered your own question. If your program will behave badly if the configuration files are corrupted, then it seems that you must provide protection against such corruption. (In fact, IMO, every program should defend itself against bad input from all external sources.) You could start by answering a few questions like these:
I just got done with a project that had a similar requirement. As in your case, my configuration files are plain text files that the users might mess with. I wound up adding a checksum record at the end that simply contains the sum of all the preceding characters in the file. A malicious attacker could easily figure out the scheme and build a corrupted file himself with a valid checksum. However, in my case there is no motivation for anyone to do that, so all I'm trying to do is defend my program against configuration files that have been accidentally changed or misnamed. -- Russ |
Topic | Author | Date |
Config File check | 01/01/70 00:00 | |
Yes. Check your input! | 01/01/70 00:00 | |
Confifg File check | 01/01/70 00:00 | |
Things that can be done... | 01/01/70 00:00 | |
Study This Thread | 01/01/70 00:00 |