changeset 31916:6b45e5fb9dc4

Fix reading of VUK: actually fail if the key is incomplete instead of continuing with uninitialized data.
author reimar
date Sat, 21 Aug 2010 10:02:50 +0000
parents c1e009d855b5
children d0d09a75bb17
files stream/stream_bd.c
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/stream/stream_bd.c	Sat Aug 21 09:58:02 2010 +0000
+++ b/stream/stream_bd.c	Sat Aug 21 10:02:50 2010 +0000
@@ -160,7 +160,6 @@
     }
     id2str(discid, 20, idstr);
     while (!stream_eof(file)) {
-        int i;
         char line[1024];
         char *vst;
 
@@ -184,12 +183,12 @@
             break;
         vst += 6;
         while (isspace(*vst)) vst++;
-        if (strlen(vst) < 32)
+        if (sscanf(vst,      "%16"SCNx64, &bd->vuk.u64[0]) != 1)
             continue;
-        for (i = 0; i < 16; i++) {
-            if (sscanf(&vst[i*2], "%2"SCNx8, &bd->vuk.u8[i]) != 1)
-                break;
-        }
+        if (sscanf(vst + 16, "%16"SCNx64, &bd->vuk.u64[1]) != 1)
+            continue;
+        bd->vuk.u64[0] = av_be2ne64(bd->vuk.u64[0]);
+        bd->vuk.u64[1] = av_be2ne64(bd->vuk.u64[1]);
         vukfound = 1;
     }
     free_stream(file);