aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-10-05 14:31:41 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-10-05 14:31:41 +0200
commit0b2e4880f5c80a97a8c4577591210185669ddb4a (patch)
treef2c66642e28373ae6cfd5e265d19b5e4f69948c9
parente531f43ad68dc96144921530742d501370193593 (diff)
downloadmblaze-0b2e4880f5c80a97a8c4577591210185669ddb4a.tar.gz
mmime: gen_build: don't crash on #-line without space
-rw-r--r--mmime.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/mmime.c b/mmime.c
index 788f4bf..b499612 100644
--- a/mmime.c
+++ b/mmime.c
@@ -301,14 +301,16 @@ gen_build()
if (!rflag && line[0] == '#') {
char *f = strchr(line, ' ');
- *f = 0;
- if (strchr(line, '/')) {
- printf("\n--%s\n", sep);
- if (line[read-1] == '\n')
- line[read-1] = 0;
- gen_file(f+1, (char *)line+1);
- intext = 0;
- continue;
+ if (f) {
+ *f = 0;
+ if (strchr(line, '/')) {
+ printf("\n--%s\n", sep);
+ if (line[read-1] == '\n')
+ line[read-1] = 0;
+ gen_file(f+1, (char *)line+1);
+ intext = 0;
+ continue;
+ }
}
}