From 501159e5882d8c68df3a4bdcf4b2c465edcc760a Mon Sep 17 00:00:00 2001 From: hyc Date: Tue, 29 Dec 2009 08:07:09 +0000 Subject: [PATCH] Strip trailing params from swfurl in saved copy git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@125 400ebc74-4327-4243-bc38-086b20814532 --- swfvfy.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/swfvfy.c b/swfvfy.c index fea1450..c75fa53 100644 --- a/swfvfy.c +++ b/swfvfy.c @@ -144,8 +144,9 @@ SWFVerify(const char *url, unsigned int *size, unsigned char *hash) if (strncmp(buf, "url: ", 5)) continue; r1 = strrchr(buf, '/'); - buf[strlen(buf)-1] = '\0'; - if (strcmp(r1, file)) + i = strlen(r1); + r1[--i] = '\0'; + if (strncmp(r1, file, i)) continue; pos = ftell(f); while (got < 3 && fgets(buf, sizeof(buf), f)) @@ -207,10 +208,17 @@ SWFVerify(const char *url, unsigned int *size, unsigned char *hash) fseek(f, pos, SEEK_SET); else { + char *q; if (!f) f = fopen(path, "w"); fseek(f, 0, SEEK_END); - fprintf(f, "url: %s\n", url); + q = strchr(url, '?'); + if (q) + i = q - url; + else + i = strlen(url); + + fprintf(f, "url: %.*s\n", i, url); } fprintf(f, "date: %s\n", date); fprintf(f, "size: %08x\n", in.size); -- 2.40.0