diff options
Diffstat (limited to 'rss.c')
| -rw-r--r-- | rss.c | 10 |
1 files changed, 9 insertions, 1 deletions
| @@ -10,6 +10,7 @@ | |||
| 10 | #include "xs_openssl.h" | 10 | #include "xs_openssl.h" |
| 11 | #include "xs_json.h" | 11 | #include "xs_json.h" |
| 12 | #include "xs_http.h" | 12 | #include "xs_http.h" |
| 13 | #include "xs_unicode.h" | ||
| 13 | 14 | ||
| 14 | #include "snac.h" | 15 | #include "snac.h" |
| 15 | 16 | ||
| @@ -74,7 +75,14 @@ xs_str *rss_from_timeline(snac *user, const xs_list *timeline, | |||
| 74 | title = xs_regex_replace_i(title, "&[^;]+;", " "); | 75 | title = xs_regex_replace_i(title, "&[^;]+;", " "); |
| 75 | int i; | 76 | int i; |
| 76 | 77 | ||
| 77 | for (i = 0; title[i] && title[i] != '\n' && i < 50; i++); | 78 | for (i = 0; title[i] && title[i] != '\n' && i < 50; ) { |
| 79 | const char *p = &title[i]; | ||
| 80 | unsigned int cp = xs_utf8_dec(&p); | ||
| 81 | int n = p - title; | ||
| 82 | if (cp == 0xfffd || n > 50) | ||
| 83 | break; | ||
| 84 | i = n; | ||
| 85 | } | ||
| 78 | 86 | ||
| 79 | if (title[i] != '\0') { | 87 | if (title[i] != '\0') { |
| 80 | title[i] = '\0'; | 88 | title[i] = '\0'; |