]> granicus.if.org Git - postgresql/commitdiff
Fix calculation of ISMN check digit.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 13 Jan 2014 13:42:35 +0000 (15:42 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 13 Jan 2014 13:44:14 +0000 (15:44 +0200)
This has always been broken, so back-patch to all supported versions.

Fabien COELHO

contrib/isn/isn.c

index 449f70b811ad0adce4bf4a71637db459f6f0df73..20bd37b83dcdd098aef828d3c24f725d54341925 100644 (file)
@@ -822,7 +822,7 @@ string2ean(const char *str, bool errorOK, ean13 *result,
                case ISMN:
                        strncpy(buf, "9790", 4);        /* this isn't for sure yet, for now
                                                                                 * ISMN it's only 9790 */
-                       valid = (valid && ((rcheck = checkdig(buf + 3, 10)) == check || magic));
+                       valid = (valid && ((rcheck = checkdig(buf, 13)) == check || magic));
                        break;
                case ISBN:
                        strncpy(buf, "978", 3);