Fossil SCM
Fix the "tag add" command to report an error if given an invalid UUID argument.
Commit
0d9abccbb6bb25b01f25c3deb78a016999afb835
Parent
8dae3bc3209b22e…
1 file changed
+5
-2
+5
-2
| --- src/tag.c | ||
| +++ src/tag.c | ||
| @@ -266,13 +266,16 @@ | ||
| 266 | 266 | Blob cksum; |
| 267 | 267 | static const char zTagtype[] = { '-', '+', '*' }; |
| 268 | 268 | |
| 269 | 269 | assert( tagtype>=0 && tagtype<=2 ); |
| 270 | 270 | user_select(); |
| 271 | - rid = name_to_rid(zObjName); | |
| 272 | 271 | blob_zero(&uuid); |
| 273 | - db_blob(&uuid, "SELECT uuid FROM blob WHERE rid=%d", rid); | |
| 272 | + blob_append(&uuid, zObjName, -1); | |
| 273 | + if( name_to_uuid(&uuid, 9) ){ | |
| 274 | + return; | |
| 275 | + } | |
| 276 | + rid = name_to_rid(blob_str(&uuid)); | |
| 274 | 277 | blob_zero(&ctrl); |
| 275 | 278 | |
| 276 | 279 | if( validate16(zTagname, strlen(zTagname)) ){ |
| 277 | 280 | fossil_fatal("invalid tag name \"%s\" - might be confused with a UUID", |
| 278 | 281 | zTagname); |
| 279 | 282 |
| --- src/tag.c | |
| +++ src/tag.c | |
| @@ -266,13 +266,16 @@ | |
| 266 | Blob cksum; |
| 267 | static const char zTagtype[] = { '-', '+', '*' }; |
| 268 | |
| 269 | assert( tagtype>=0 && tagtype<=2 ); |
| 270 | user_select(); |
| 271 | rid = name_to_rid(zObjName); |
| 272 | blob_zero(&uuid); |
| 273 | db_blob(&uuid, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 274 | blob_zero(&ctrl); |
| 275 | |
| 276 | if( validate16(zTagname, strlen(zTagname)) ){ |
| 277 | fossil_fatal("invalid tag name \"%s\" - might be confused with a UUID", |
| 278 | zTagname); |
| 279 |
| --- src/tag.c | |
| +++ src/tag.c | |
| @@ -266,13 +266,16 @@ | |
| 266 | Blob cksum; |
| 267 | static const char zTagtype[] = { '-', '+', '*' }; |
| 268 | |
| 269 | assert( tagtype>=0 && tagtype<=2 ); |
| 270 | user_select(); |
| 271 | blob_zero(&uuid); |
| 272 | blob_append(&uuid, zObjName, -1); |
| 273 | if( name_to_uuid(&uuid, 9) ){ |
| 274 | return; |
| 275 | } |
| 276 | rid = name_to_rid(blob_str(&uuid)); |
| 277 | blob_zero(&ctrl); |
| 278 | |
| 279 | if( validate16(zTagname, strlen(zTagname)) ){ |
| 280 | fossil_fatal("invalid tag name \"%s\" - might be confused with a UUID", |
| 281 | zTagname); |
| 282 |