aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/nsfe_extractor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/nsfe_extractor.c')
-rw-r--r--src/plugins/nsfe_extractor.c46
1 files changed, 30 insertions, 16 deletions
diff --git a/src/plugins/nsfe_extractor.c b/src/plugins/nsfe_extractor.c
index 1f3d35f..08c0509 100644
--- a/src/plugins/nsfe_extractor.c
+++ b/src/plugins/nsfe_extractor.c
@@ -84,6 +84,8 @@ nsfestring (const char *data, size_t size)
84 (data[length] != '\0') ) 84 (data[length] != '\0') )
85 length++; 85 length++;
86 s = malloc (length + 1); 86 s = malloc (length + 1);
87 if (s == NULL)
88 return NULL;
87 strncpy (s, data, length); 89 strncpy (s, data, length);
88 s[strlen (data)] = '\0'; 90 s[strlen (data)] = '\0';
89 return s; 91 return s;
@@ -157,8 +159,11 @@ libextractor_nsfe_tlbl_extract(const char *data,
157 for (left = size; left > 0; left -= length) 159 for (left = size; left > 0; left -= length)
158 { 160 {
159 title = nsfestring (&data[size - left], left); 161 title = nsfestring (&data[size - left], left);
160 length = strlen (title) + 1; 162 if (title != NULL)
161 ADDF (title, EXTRACTOR_METATYPE_TITLE); 163 {
164 length = strlen (title) + 1;
165 ADDF (title, EXTRACTOR_METATYPE_TITLE);
166 }
162 } 167 }
163 return 0; 168 return 0;
164} 169}
@@ -177,25 +182,34 @@ libextractor_nsfe_auth_extract (const char *data, size_t size,
177 if (left < 1) 182 if (left < 1)
178 return 0; 183 return 0;
179 album = nsfestring (&data[size - left], left); 184 album = nsfestring (&data[size - left], left);
180 left -= (strlen (album) + 1); 185 if (album != NULL)
181 ADDF (album, EXTRACTOR_METATYPE_ALBUM); 186 {
182 if (left < 1) 187 left -= (strlen (album) + 1);
183 return 0; 188 ADDF (album, EXTRACTOR_METATYPE_ALBUM);
189 if (left < 1)
190 return 0;
191 }
184 192
185 artist = nsfestring (&data[size - left], left); 193 artist = nsfestring (&data[size - left], left);
186 left -= (strlen (artist) + 1); 194 if (artist != NULL)
187 ADDF (artist, EXTRACTOR_METATYPE_ARTIST); 195 {
188 if (left < 1) 196 left -= (strlen (artist) + 1);
189 return 0; 197 ADDF (artist, EXTRACTOR_METATYPE_ARTIST);
198 if (left < 1)
199 return 0;
200 }
190 201
191 copyright = nsfestring (&data[size - left], left); 202 copyright = nsfestring (&data[size - left], left);
192 left -= (strlen (copyright) + 1); 203 if (copyright != NULL)
193 ADDF (copyright, EXTRACTOR_METATYPE_COPYRIGHT); 204 {
194 if (left < 1) 205 left -= (strlen (copyright) + 1);
195 return 0; 206 ADDF (copyright, EXTRACTOR_METATYPE_COPYRIGHT);
196 207 if (left < 1)
208 return 0;
209 }
197 ripper = nsfestring (&data[size - left], left); 210 ripper = nsfestring (&data[size - left], left);
198 ADDF (ripper, EXTRACTOR_METATYPE_RIPPER); 211 if (ripper != NULL)
212 ADDF (ripper, EXTRACTOR_METATYPE_RIPPER);
199 return 0; 213 return 0;
200} 214}
201 215